Hey there,
I made a program for collatz conjecture, wich basically:
stops when n=1
if n is dividable by 2 = divide by 2
if n isn't = 3*n+1.
here it is:
if I save it, after the program finishes, it closes the window immediatelly. is there any way to make it run again? (request a new output)
I made a program for collatz conjecture, wich basically:
stops when n=1
if n is dividable by 2 = divide by 2
if n isn't = 3*n+1.
here it is:
print 'Write a number, then press Enter, I will show you the way to 1!' n=int(input('Enter here:')) Steps = 0 while 1>0: if n == 1: print '1' break remainder = n % 2 if remainder == 0: print n n = n/2 if remainder == 1: print n n = n*3+1 Steps = Steps+1 answer = str('=== it took') answer2 = str('steps to get to 1 ===') print answer, Steps, answer2ok, but when it finishes, in the shell it stops with >>>, where I can read the output.
if I save it, after the program finishes, it closes the window immediatelly. is there any way to make it run again? (request a new output)