EOF error | Sololearn: Learn to code for FREE!
0

EOF error

So, with what I've learned to this point (up to else statements), I tried to write this code: x = int(input("complete this problem:1+1+1+1=...")) if x==4: print("correct") else: print("incorrect") print("try again") x = int(input("complete this problem: 1+1+1+1=...")) if x==4: print("FINALLY! CORRECT!") else: print("wrong again") I am getting an EOF error at line 7. Can anyone advise how to fix this and explain what I did wrong? thanks.

20th Jan 2017, 7:39 PM
Moe Szyslak
Moe Szyslak - avatar
3 Answers
+ 2
u can do it easier with a loop it will repeat till the user enters 4 x = 0 while x != 4: x = int(input("Complete -> 1+1+1+1=...")) if x == 4: print("correct") else: print("Incorrect") print("Try Again")
20th Jan 2017, 7:53 PM
Kawaii
Kawaii - avatar
+ 1
the Code i posted will do that
20th Jan 2017, 11:47 PM
Kawaii
Kawaii - avatar
0
if I END the code at line 7 it works, but the code needs to be rerun again...and again...until the correct answer is entered. is there a way change this code to continue to prompt the user for input until the correct answer is entered? again, there is an EOF error line 7.
20th Jan 2017, 8:58 PM
Moe Szyslak
Moe Szyslak - avatar