Advertisement
Tons62

Untitled

Dec 11th, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. print ("Hi, I am Marvin, your personal bot. ")
  2. #ask the user to enter their name
  3. name =input ("what is your name? ")
  4. #print a message including the name
  5. print ("Hello " + name)
  6. command=input("How can I help? ")
  7. if command == "add" or command == "plus":
  8. print ("Let's add some numbers")
  9. input1 = input("Number 1> ")
  10. input2 = input("Number2> ")
  11. number1 = int(input1)
  12. number2 = int(input2)
  13. result = number1 + number2
  14. output = str(result)
  15. print(input1 + " + " + input2 + " = " + output)
  16. elif command == "subtract" or command == "take away":
  17. print ("Let's subtract some numbers")
  18. input1 = input("Number 1> ")
  19. input2 = input("Number2> ")
  20. number1 = int(input1)
  21. number2 = int(input2)
  22. result = number1 - number2
  23. output = str(result)
  24. print(input1 + " - " + input2 + " = " + output)
  25. #we need to include other commands
  26. elif command == "multiply" or command == "times":
  27. print ("Let's Multiply some numbers")
  28. input1 = input("Number 1> ")
  29. input2 = input("Number2> ")
  30. number1 = int(input1)
  31. number2 = int(input2)
  32. result = number1 * number2
  33. output = str(result)
  34. print(input1 + " - " + input2 + " = " + output)
  35. elif command == "divide" or command == "share":
  36. print ("Let's Divide some numbers")
  37. input1 = input("Number 1> ")
  38. input2 = input("Number2> ")
  39. number1 = int(input1)
  40. number2 = int(input2)
  41. result = number1 / number2
  42. output = str(result)
  43. print(input1 + " / " + input2 + " = " + output)
  44. elif command == "average":
  45. how_many = input ("How many numbers> ")
  46. how_many = int (how_many)
  47. total =0
  48. for number_count in range (how_many):
  49. number = input ("Enter number " +str (number_count) + "> ")
  50. total = total + int (number)
  51. result = total/how_many
  52. print ("the average = " + str(result))
  53. elif command == "Add Vat":
  54. print ("Lets add VAT to an item")
  55. input1 = input ("How much did the item cost? >£")
  56. input2 = input ("What is the current rate of VAT? >" "%")
  57. number1 = int(input1)
  58. number2 = int(input2)
  59. result = number1 + number1 / 100 * number2
  60. print ("You will pay = £ " +str (result) + " icluding VAT")
  61. else:
  62. print ("Sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement