Tom_Jung

Untitled

Jan 17th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. print("Hi, I am R6D6, your personal math bot")
  2. print("Please enter a single word command when requested: ")
  3. command = input("How may I help you: add or subtract or average or shopping or split cost of meal? ")
  4.  
  5. if command == "add" or command == "plus":
  6. print("Let's add some numbers")
  7. number1 = int(input("number 1: "))
  8. number2 = int(input("number 2: "))
  9. result = number1 + number2
  10.  
  11. print("Results:", number1, "+" ,number2, "=", result)
  12.  
  13. elif command == "subtract" or command == "minus":
  14. print("Let's substract some numbers")
  15. number1 = int(input("number 1: "))
  16. number2 = int(input("number 2: "))
  17. result = number1 - number2
  18.  
  19. print("Results:", number1, "minus", number2, "=", result)
  20.  
  21. elif command == "average":
  22. how_many = input("How many numbers do you want to average? ")
  23. how_many = int(how_many)
  24. total = 0
  25. for number_count in range(how_many):
  26. number = input("Enter number " + str(number_count) + " = ")
  27. total = total + int(number)
  28. result = total / how_many
  29. print("average is = " + str(result))
  30.  
  31. elif command == "meal":
  32. how_many = int(input("How many person dined? "))
  33. meal_cost = float(input("What did the meal cost? "))
  34. tip = float(input("What percent tip do you want to leave? "))
  35. local_tax = float(input("Hoat is the local tax percent rate? "))
  36. total_meal_cost = (meal_cost) + (meal_cost * tip/100) + (meal_cost * local_tax/100)
  37. total_diner =(total_meal_cost / how_many)
  38. print("Cost per diner is", total_diner, "USD")
  39.  
  40. else:
  41. print("Sorry, this is the add or subtract or average or meal math bot")
Advertisement
Add Comment
Please, Sign In to add comment