+ 1

Python 3

It's been a week for me learning Python 3. I'm trying to code a simple calculator. I can't find the error in the code The error message says that an error occurred when reading line 3. Thanks for helping while True : print('1) add\n2) subtract\n3) multiply\n 4) quit') x = input('Operation of Choice : ') if x == 1 : a = input('num1 : ') b = input('num2 : ') c = a + b print('Your answer is',c ) elif x == 2 : a = input('num1 : ') b = input('num2 : ') c = a - b print('Your answer is',c ) elif x == 3 : a = input('num1 : ') b = input('num2 : ') c = a * b print('Your answer is',c ) elif x == 4 : break

28th Sep 2017, 4:13 AM
Sukhmit Bhullar
Sukhmit Bhullar - avatar
2 Answers
+ 1
it's probably the first print statement . u have to close the ( )
28th Sep 2017, 5:23 AM
jay
+ 1
The error is in line 3. Changing anything in line 2 didn't made any difference. Thanks for helping tho
28th Sep 2017, 1:01 PM
Sukhmit Bhullar
Sukhmit Bhullar - avatar