0

Is this not how it works?

There's an error in the or part apparently https://code.sololearn.com/cZN7L76EoEZ9/?ref=app

16th Aug 2019, 6:13 PM
ERROR_404
ERROR_404 - avatar
6 Answers
0
one thing I saw is that your input for the (strike:operand)—>operator is still a string but you aren’t comparing to strings in your if statements
16th Aug 2019, 6:16 PM
Brave Tea
Brave Tea - avatar
0
I'm trying to write a code for a simple calculator... doesnt using float before the input convert it?
16th Aug 2019, 6:18 PM
ERROR_404
ERROR_404 - avatar
0
are you making a calculator? furthermore print(xzy) isn’t going to do anything because you have declared an xzy variable perhaps you meant print(x,z,y) but this will not calculate anything, it will simply print numbers and an operator
16th Aug 2019, 6:23 PM
Brave Tea
Brave Tea - avatar
0
ERROR_404 yes it does that, but not all types are created equal and you can’t use all types the same. if you do if z == ‘*’ or z == ‘+’ or etc: then it will work
16th Aug 2019, 6:36 PM
Brave Tea
Brave Tea - avatar
0
have you looked at the lesson in the Python course where it talks about making a simple calculator?
16th Aug 2019, 6:37 PM
Brave Tea
Brave Tea - avatar
0
Hi. Additionally to the points mentioned by Brave Tea you should be comparing the entered operation against string values, i.e. z == '+'
16th Aug 2019, 6:38 PM
ChrA
ChrA - avatar