import math a = input("Give me a number:") sign = input("Give me a sign:") b = input("Give me another number:") result = 0 if sign == "+": result = int(a) + int(b) print("You asked for the sum") print(a,"plus", b, "is", result) elif sign == "-": result = int(a) - int(b) print("You asked for the difference") print(a,"minus", b, "is", result) elif sign == "*": result = int(a) * int(b) print("You asked for the product") print(a,"multilpied by", b, "is", result) elif sign == "/": result = int(a) / int(b) print("You asked for the quotient") print(a,"divided by", b, "is", result) elif sign == "power": result = math.pow(int(a),int(b)) print("You asked for the power") print(a,"on the power of", b, "is", result) else: print("Sorry, I don't know that sign!") |
Silver Announcements >