0

Why am I getting a SyntaxError in line 6?

x = [2, 4] a = 0 b = a + 1 y = 0 while y <= 4000000: x[a] + x[b] = y x.append(y) a += 1

20th Sep 2020, 12:06 PM
ItzNekS
ItzNekS - avatar
3 Réponses
+ 3
At line 6 you are assigning a value to a value , 2+4=0 which obviously won't work
20th Sep 2020, 12:11 PM
Abhay
Abhay - avatar
+ 2
Replace x[a] + x[b] =y with y = x[a] + x[b]
20th Sep 2020, 12:11 PM
Vadivelan