I should be getting this as my output, but it keeps going through each result:
10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 ; length = 7
11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -
> 4 -> 2 -> 1 ; length = 15
12 -> 6 -> 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 ; length = 10
This is the code I have come up with:
start = input("Enter the starting number ( 1 - 10000 ) ")
print "Enter the ending number (",start+1,"- 10000 )",
end = input()
number = start
number >= start
number <= end
length = 1
print number, '->',
while number != 1:
for i in range (start,end):
if number %2 == 0:
number = number/2
print number, '->',
else:
number = (number*3)+1
print number, '->',
length= length+1
print ' length = ',length,'\n',
Can somebody please help me with this, I feel like there is one line missing or something.
Thanks in advance!