my simple Python calculator
Web Development
1
Posts
1
Posters
29
Views
1
Watching
-
type = input("Enter type of calculation: ") try: x = int(input("Enter first number: ")) y = int(input("Enter second number: ")) except ValueError: print("Please input correct information.") def calculate(x, y, type): if type == "+": return x + y elif type == "-": return x - y elif type == "*": return x * y elif type == "/": return x / y else: return "Wrong inputs") result = calculate(x, y, type) print(result)