Ok so I wrote this up quickly and it SHOULD work but doesn't. Can someone possibly run ME through this. I admit I am struggling a bit with the concept of return vs print(I get it conceptually...but application wise I trip)
link to SO source: https://stackoverflow.com/questions/3350...ring-stuff
c = int(input('enter num: ')) i = 1 while True: if c % 2 == 0: c = c // 2 print(i,']', c) elif c % 2 == 1: c = (3*c+1)//2 print(i, ']',c) elif c == 1: print('took',i,'tries') i+=1this is something I took off SO: I played with it a bit and I've commented parts I don't get...
link to SO source: https://stackoverflow.com/questions/3350...ring-stuff
#Can someone run through this with me? def coll(x): i=1 if c % 2 == 0: print(i,'] even',c//2) return c//2 elif c % 2 == 1: result = (3*c +1)//2 #idu the change in variable here? print(i, '] odd',result) return result i += 1 c = int(input('enter your num: ')) while c != 1: c = coll(int(c))