+ 2
I am getting a name error in a simple calculator program.
to run the code you enter 2 number and the first letter of one of 4 operations. a=+, s=-,m =*,d=/ https://code.sololearn.com/cbLVF8kdRQ50/?ref=app
2 Answers
+ 7
The NameError is because a, s, m, and d are interpreted as variables, instead of values. To make them string values, surround them in either single quotes or double quotes. Then you can compare them to the input.
Ex:
if op == "a":
+ 2
thanks that makes sence