+ 1
Y iam getting name error 'c' is not defined when i use - sign and when i use + sign it is giving output your answer is 3 times
num = input("option: +,*,-") a = int(input("enter any number:")) b = int(input("enter any number:")) if num == "+": c = a + b print (" your Answer is",c) if num == "-": c = a - b print("your answer is",c) if num == "*": c = a * b print("your answer is",c)
1 Respuesta
+ 2
indent the print func inside the if stmt..after checking the first statement false,it run the print func,therefore c is undefined
or you could just use the print func at very end of ur code