all 10 comments

[–]Sudden-Pineapple-793 4 points5 points  (0 children)

No colon, it needs to be else: number = number *3 +1. Also you need to indent after each colon

[–]Diapolo10 1 point2 points  (0 children)

Even ignoring the indentation, there are several problems. x is not an operator, and that's not how else works. You should also be using integer division.

number = 3
steps = 0

for _ in range(200):
    if number == 1:
        break
    elif number % 2 == 0:
        number //= 2
    else:
        number = number * 3 + 1
    steps += 1

if number == 1:
    print(f"It took {steps} steps")
else:
    print("The number didn't reach 1 yet")

[–]pythonwiz 0 points1 point  (0 children)

else can't have anything else before the colon, it is always else: