0
Syntax error on line 36, not really sure why though
https://sololearn.com/compiler-playground/c2DZox9sYd4r/?ref=app I am trying with a simple coding to take input from user and let them decide which math operation to choose but somehow I was stuck with the conditional statement while choosing math operation, assistance and explanation would be highly appreciated, thanks guys!
3 ответов
+ 3
the syntax of all the if conditionals is not correct.
(1) instead:
if math_equation: "+"
return addition(num1,num2)
we should use:
if math_equation == "+":
addition(num1,num2)
(2) you should also not use individual if conditionals, but we should use a structure like:
if... :
do this operation
elif...:
do that operation
...
else:
do this
(3) also this line is not correct:
math_equation = string(input("Decide which mathematical equation to be compute by entering the respective mathematical symbol(+-*/):"))
there is no function string(..), and we don't need to convert input to a string, this is done by default.
+ 3
also, you have indentation errors.
"return" can only be used in functions
0
Thank you everyone for your kind assistance😃, the code is working perfectly, thanks alot!