Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. print("Hi, I'm Marvin, your personal bot. Let's get started!")
  2. command = input("How can I help? ")
  3. if command == "add" or command == "addition" or command =="plus":
  4. print("Let's do some additions!")
  5. input1 = input("number one: ")
  6. input2 = input("number two: ")
  7. number1 = int(input1)
  8. number2 = int(input2)
  9. result = number1 + number2
  10. output = str(result)
  11. print(input1 + "+" + input2 + "=" + output)
  12. elif command == "subtract" or command == "minus":
  13. print("Let's do some subtractions!")
  14. input1 = input("number one: ")
  15. input2 = input("number two: ")
  16. number1 = int(input1)
  17. number2 = int(input2)
  18. result = number1 - number2
  19. output = str(result)
  20. print(input1 + "-" + input2 + "=" + output)
  21. elif command == "multiply":
  22. print("Let's do some multiplications!")
  23. input1 = input("number one: ")
  24. input2 = input("number two: ")
  25. number1 = int(input1)
  26. number2 = int(input2)
  27. result = number1 * number2
  28. output = str(result)
  29. print(input1 + "*" + input2 + "=" + output)
  30. elif command == "divide":
  31. print("Let's do some division!")
  32. input1 = input("number one: ")
  33. input2 = input("number two: ")
  34. number1 = int(input1)
  35. number2 = int(input2)
  36. result = number1 / number2
  37. output = str(result)
  38. print(input1 + "/" + input2 + "=" + output)
  39. elif command =="area":
  40. print("Let's calculate the area of a rectangle!")
  41. input1 = input("side a in centimetres: ")
  42. input2 = input("side b in centimetres: ")
  43. number1 = int(input1)
  44. number2 = int(input2)
  45. result = number1 * number2
  46. output = str(result)
  47. print("The area of the rectangle is " + output + " centimeters squared.")
  48. else:
  49. print("Sorry- I do not understand that command.")
  50. print("Bye!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement