python – a collatz program automate the boring stuff [closed]

You are not updating number in your while loop so you are stuck in an infinite loop.

You should assign return value of collatz to number back, to update number.

while number != 1:
    number = collatz(number)
    print(number)

Leave a Comment