- 5

I'm having problems with the simple calculator. Help

11. break 12. elif user_input=="add": 13. ... 14. elif user_input=="subtract": 15. ... I tried out this code, buh it shows me SyntaxError: invalid syntax in LINE 13. help

12th Sep 2016, 10:06 AM
Paul Osakue
Paul Osakue - avatar
7 Respuestas
+ 5
Well, how about showing us what you actually put in line 13 instead of "..."? (Unless you DID put "...", which would explain the synthax error.)
12th Sep 2016, 10:09 AM
Zen
Zen - avatar
+ 2
You were supposed to put the actual code to handle the operation instead of the 3 dots.
12th Sep 2016, 10:21 AM
Zen
Zen - avatar
+ 1
the ... is just a placeholder, go through the rest of the tutorial to finish each statement eg. if user_input="add": num1=float (input ("enter the 1st number")) num2=float (input ("enter the 2nd number")) result=str(num1+num2) print("answer is: "+result)
17th Sep 2016, 11:41 PM
Abraham Stellato
Abraham Stellato - avatar
0
I actually put the three dots in line 13 (...) That was how I saw it in the tutorial of A SIMPLE CALCULATOR
12th Sep 2016, 10:12 AM
Paul Osakue
Paul Osakue - avatar
0
Hmm.. What code? Kinda confused here
12th Sep 2016, 10:41 AM
Paul Osakue
Paul Osakue - avatar
0
you need to write actual codes instead of the ... if you fill out the blanks in "creating a calculator, I'd look like this: elif user_input=="add" num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1+num2) print("The answer is"+result) elif user_input=='substract' num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1-num2) print("The answer is"+result) elif user_input=="multiply" num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1*num2) print("The answer is"+result) elif user_input =="divide" num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1/num2) print("The answer is"+result) else: print("Unknown input")
9th Dec 2016, 4:28 PM
Franny
Franny - avatar
0
Please See My New Code Basic Calculator (Web)
19th Dec 2016, 1:36 PM
Bruh