- 1

Please can anyone assist to debug this program for me?

Its just a simple calculator using if statement in Python https://code.sololearn.com/csq1bt959x9H/?ref=app

18th Jan 2022, 4:20 PM
Yusuf Bello Garga
Yusuf Bello Garga - avatar
4 Respuestas
+ 3
op should be a string variable not float. op = input("Enter operand")
18th Jan 2022, 5:09 PM
Simba
Simba - avatar
0
It seems to work, what are you having issues with? Of course the scanf can be exploited but your code works.
18th Jan 2022, 4:33 PM
William Owens
William Owens - avatar
0
num1 = float(input("First Number:")) op = float(input("Enter operand")) num2 = float(input("Enter Second Number")) if op == "+": print(num1 + num2 ) elif op == "*": print(num1 * num2 ) elif op == "-": print(num1 - num2 ) elif op == "/": print(num1 / num2 ) else: print("invalid operator")
18th Jan 2022, 4:50 PM
Yusuf Bello Garga
Yusuf Bello Garga - avatar
0
I cant able to run this program
18th Jan 2022, 4:50 PM
Yusuf Bello Garga
Yusuf Bello Garga - avatar