How can I separate the calculator into 2 parts? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I separate the calculator into 2 parts?

I recommend using another compilator separately (like Spyder) to understand the error. What I want to do is that when you enter one of the letters, only one formula is activated and nothing else Since what happens is that they activate 2, help me? https://code.sololearn.com/cHnm0kUow2Da/?ref=app

21st Feb 2019, 5:07 AM
José Antonio Matuz Argueta
José Antonio Matuz Argueta - avatar
5 Answers
+ 4
In line 6, you're saving the user input in a variable. Do the same in line 2. Also, in line 2 you use the input() function to display a text. Why do you expect the same function to compare user input to a string in line 4?
21st Feb 2019, 5:54 AM
Anna
Anna - avatar
21st Feb 2019, 7:49 AM
Bohdan
Bohdan - avatar
+ 5
Compare line 2 and line 6. One is correct, the other one isn't. And the syntax of a comparison is "if x == y", not "if x(y)" (line 4).
21st Feb 2019, 5:16 AM
Anna
Anna - avatar
+ 3
hehehe Thanks
21st Feb 2019, 5:59 AM
José Antonio Matuz Argueta
José Antonio Matuz Argueta - avatar
+ 2
??
21st Feb 2019, 5:52 AM
José Antonio Matuz Argueta
José Antonio Matuz Argueta - avatar