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?
2 Antworten
+ 2
Rather than using <= for testing the value of z within the conditionals, try using == as that operator specifically tests equality
+ 1
https://www.sololearn.com/Profile/6288336@Faisal Thanks a lot,looks like i need more practice