+ 1
Python. Can someone please explain me what's the problem?
a = int(input()) while a!=1 print (a) if a & 2 == 0: a = a // 2 else: a = 3 * a + 1 print (a) I am trying to create to collatz project and it shows me an error. Can someone please say what's the problem.
9 ответов
+ 3
Thanks
Anya, Dima Makieiev and Dmitriy Novak
+ 2
You forgot in while the : the the end
+ 1
You need to ad colon in while while a!=1:
0
Anya
After 1?
0
JohnSia2005 Like Dima Makieiev suggested
0
Hi!
You mist colon in while loop. It should be:
while a != 1:
0
Dmitriy, Anya, Dima Makieiev
There's a mistake at if a % 2 == 0.
Whats the mistake?
0
Dmitriy, Anya, Dima Makieiev
There's a mistake at if a % 2 == 0.
Whats the mistake?