+ 2
I need help regarding this code. [Python]
I've written a code for Collatz Conjecture. But I don't know why the while loop in this code doesn't stops after the variable 'num' reaches to 1. https://www.sololearn.com/learn/6768/?ref=app https://code.sololearn.com/cZK5y7tl6AS7/?ref=app
2 odpowiedzi
+ 1
I believe the problem lies in your second if clause. 1%2 will not return 0 so you might change this to an else since you have to do this anyway if the first case is not true.
0
Christian Andrä Thank you so much, it worked