Please help me to output the first number + operator + second number and it is not divided by anything, I don't know why | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please help me to output the first number + operator + second number and it is not divided by anything, I don't know why

https://code.sololearn.com/c53n7gDrjeTM/?ref=app

2nd Nov 2020, 3:08 AM
João Bernardo
João Bernardo - avatar
2 Answers
+ 4
The condition at line 13 is always true, no matter the input. (operator == "x") or "*": Let's say operator is "/" operator == "x" is False Then: False or "*" "*" Is True(thy) because it's a non-empty string. Hence, the condition's body runs. The next elif (division) is never reached because of that. That's why division won't work. Try: elif operator == "x" or operator == "*": Remember that on SoloLearn you have to enter input on saparate lines this way : 10 / 5
2nd Nov 2020, 3:28 AM
Kevin ★
+ 1
Thanks so much! Now I get it. I really didn't know about it
2nd Nov 2020, 5:07 PM
João Bernardo
João Bernardo - avatar