Problem with a code | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Problem with a code

Hi. I have a problem and I'm asking for help because I can't deal with it. I tried to write a code for the calculator, but I still get the error: File "..\Playground\", line 17 elif user_input = "subtract": Ā Ā Ā  ^ SyntaxError: invalid syntax https://code.sololearn.com/cXe3wrPD5bjq/?ref=app

9th Oct 2019, 12:48 PM
Joanna
Joanna - avatar
7 Respostas
+ 3
It is happening because of wrong indent. There should be a space before any line in Python otherwise it will give error. Check this edited by me https://code.sololearn.com/ct211GEjP5va/?ref=app
9th Oct 2019, 1:08 PM
AĶ¢J
AĶ¢J - avatar
+ 3
Check this once. If you will not follow this then you will get error in python. https://www.google.com/amp/s/www.geeksforgeeks.org/statement-indentation-and-comment-in-python/amp/
9th Oct 2019, 1:12 PM
AĶ¢J
AĶ¢J - avatar
+ 1
Oh, I see. Thank you. ;)
9th Oct 2019, 8:20 PM
Joanna
Joanna - avatar
0
Thank you very much! Now I understand!
9th Oct 2019, 1:28 PM
Joanna
Joanna - avatar
0
also in your example you use = as an assignment operator. you should be using == which is an comparison operator
9th Oct 2019, 4:41 PM
Brave Tea
Brave Tea - avatar
0
Brave Tea which line do you mean?
9th Oct 2019, 4:49 PM
Joanna
Joanna - avatar
0
the one you typed in your question. itā€™s in the syntaxError
9th Oct 2019, 8:19 PM
Brave Tea
Brave Tea - avatar