Calculator
Profile icon
ProCode1227

A simple calculator for simple people. Without a calculator, i don't know what i would do in math. Probably fail...

You are viewing a single comment. View All
Profile icon
ShibePlanetDSA

Division by zero error, I reccomend putting a try function to prevent errors from appearing and messing up the script.

try: choice = input("Enter choice(1/2/3/4): ") num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) if choice == '1': print(num1,"+",num2,"=", add(num1,num2)) elif choice == '2': print(num1,"-",num2,"=", subtract(num1,num2)) elif choice == '3': print(num1,"*",num2,"=", multiply(num1,num2)) elif choice == '4': print(num1,"/",num2,"=", divide(num1,num2)) else: print("Invalid input") except: print("An error occured!")
Profile icon
ProCode1227

@AlexRamirez2 Wow, thanks! I will put that in right now!

Profile icon
ProCode1227

@Alexramirez2 I think that i fixed it. Thanks again!

Profile icon
ProCode1227