+ 1

Whats wrong here

print("THIS IS A TWO NUMBER CALCI") ADD = '+' SUBTRACT ='-' MULTIPLY = '*' DIVIDE = '/' EXPONENTIAL= '**' FLOOR = '//' MODULO = '%' operator = input() print('operator',operator) num1 = int(input()) print('num1',num1) num2 = int(input()) print('num2',num2) if (operator == ADD): print(num1 + num2) elif (operator == SUBTRACT): print(num1 - num2) elif (operator == MULTIPLY ): print(num1 * num2) elif (operator == DIVIDE): print(num1 / num2) elif (operator == EXPONENTIAL): print(num1 ** num2) elif (operator == FLOOR): print(num1 // num2) else: print(num1 % num2)

14th Mar 2022, 4:27 AM
Sahil Patil
2 Antworten
+ 1
Nothing wrong Do you know how to give input in solo learn?? +(Hit enter) 5(hit enter) 6(hit enter) Click 'submit'
14th Mar 2022, 5:19 AM
JOKER
JOKER - avatar
+ 1
Maybe add an anticipation for possibility of division by zero.
14th Mar 2022, 5:54 AM
Ipang