Y
Y
Yura Zborowski2020-07-31 10:20:14
Python
Yura Zborowski, 2020-07-31 10:20:14

Invalid syntax error in python, how to fix?

I recently started learning python, but every time I write an if statement, an invalid syntax error occurs, indicating that the error is due to a parenthesis at the end.
Here is the code:

plusminus=input("What do we do, plus or minus")
numderone=input("Enter the first number")
numdertwo=input("Enter the second number")
if(plusminus=="+")
print(numderone + numdertwo )
else(plusminus=="-")
print(numderone - numdertwo)

I hope they help me.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ronald McDonald, 2020-07-31
@NedoKoder101

if(plusminus=="+")

Where is the colon?

S
soremix, 2020-07-31
@SoreMix

It does not indicate that the error is due to a parenthesis, but to the last character near the error
Read basic things such as if-else
https://pythonworld.ru/osnovy/instrukciya-if-elif-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question