0
Calculator -python
while True: num1 = float(input('enter first number')) operand = input('enter the operand') num2 = float(input('enter second number')) if operand == 'add': print (num1+num2) else: break This code turns up an error saying add has not been defined. Help
3 odpowiedzi
+ 2
When the program asked you for input you probably typed + so add wasn't found.
Add is not an operator so I am not sure if it still works when you type 'add' when the program asks you for input.
+ 2
Try + instead of 'add'
0
Thanks it worked. But I would like to know why ‘add’ turned up an error