Source code:
inputStr = raw_input(“Input a number:”)
number = int(inputStr)
if number <= 0:
## number = number / 2
print ” You entered a negative number or zero.”
else:
print “This is the sequence for”, number, “==>”,number,
while number > 1:
if number % 2 == 0:
number = number / 2
## print “You entered an even number”
print number,
else:
number = number * 3 + 1
## print “You have an odd number”
print number,
print “End.”
Description:
the first two lines are to input number into python. Then i put codes that will give me different answers depending on what number i picked. for example when i put the number -3, it ended the the program because in the program, I put in the code if number <= 0: that it would show ‘you entered a negative number or zero’ in the program and the program would end when that happened. the rest of the numbers i picked are from the examples in the lab descriptions and got the =same numbers shown in each sequence.