Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am R6D6, your personal math bot")
- print("Please enter a single word command when requested: ")
- command = input("How may I help you: add or subtract or average or shopping or split cost of meal? ")
- if command == "add" or command == "plus":
- print("Let's add some numbers")
- number1 = int(input("number 1: "))
- number2 = int(input("number 2: "))
- result = number1 + number2
- print("Results:", number1, "+" ,number2, "=", result)
- elif command == "subtract" or command == "minus":
- print("Let's substract some numbers")
- number1 = int(input("number 1: "))
- number2 = int(input("number 2: "))
- result = number1 - number2
- print("Results:", number1, "minus", number2, "=", result)
- elif command == "average":
- how_many = input("How many numbers do you want to average? ")
- how_many = int(how_many)
- total = 0
- for number_count in range(how_many):
- number = input("Enter number " + str(number_count) + " = ")
- total = total + int(number)
- result = total / how_many
- print("average is = " + str(result))
- elif command == "meal":
- how_many = int(input("How many person dined? "))
- meal_cost = float(input("What did the meal cost? "))
- tip = float(input("What percent tip do you want to leave? "))
- local_tax = float(input("Hoat is the local tax percent rate? "))
- total_meal_cost = (meal_cost) + (meal_cost * tip/100) + (meal_cost * local_tax/100)
- total_diner =(total_meal_cost / how_many)
- print("Cost per diner is", total_diner, "USD")
- else:
- print("Sorry, this is the add or subtract or average or meal math bot")
Advertisement
Add Comment
Please, Sign In to add comment