LAB3_Python


This is the 3rd lab of EMT 1111.My task isĀ 
prompt the user for an integer and display, for that integer, the hailstone sequence. ContinueĀ prompting the user for a number to process until a negative number is entered, indicating theĀ user wishes to quit the program.

Source Codeļ¼š

inputStr= raw_input(‘Input a number:’)
number= int(inputStr)

 

while number != 1:
print number,
if number%2 == 0:
number = number/2
else:
number = number*3+1
print number