So i made a simple calculator,why does the * is not working? (solved) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So i made a simple calculator,why does the * is not working? (solved)

so here is the code: x = int(input("Enter your first number\n")) y = int(input("Enter you second number\n")) z = str(input("+ - * / ?\n")) if z <= ("+"): print(x + y) elif z <= ("-"): print(x - y) elif z <= ("*"): print(x * y) elif z<= ("/"): print(x / y) why does the "*" not working?

7th Dec 2019, 5:00 PM
Aiken Arys
Aiken Arys - avatar
2 Answers
+ 2
Rather than using <= for testing the value of z within the conditionals, try using == as that operator specifically tests equality
7th Dec 2019, 5:02 PM
Faisal
Faisal - avatar
+ 1
https://www.sololearn.com/Profile/6288336@Faisal Thanks a lot,looks like i need more practice
7th Dec 2019, 5:11 PM
Aiken Arys
Aiken Arys - avatar