Advertisement
Guest User

Add, Subtract, Multiply, Divide Maths Bot

a guest
Aug 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. print("Hi, I am Marvin, your personal bot.")
  2. command = input("How can I help? ")
  3. #addition
  4. if command == "add":
  5. print("lets add some numbers")
  6. input1 = input("Number 1> ")
  7. input2 = input("Number 2> ")
  8. number1 = int(input1)
  9. number2 = int(input2)
  10. result = number1 + number2
  11. output = str(result)
  12. print(input1 + " + " + input2 + " = " + output)
  13. #subtraction
  14. elif command == "subtract":
  15. print("lets subtract some numbers")
  16. input1 = input("Number 1> ")
  17. input2 = input("Number 2> ")
  18. number1 = int(input1)
  19. number2 = int(input2)
  20. result = number1 - number2
  21. output = str(result)
  22. print(input1 + " - " + input2 + " = " + output)
  23. #multiply
  24. elif command == "multiply":
  25. print("lets multiply some numbers")
  26. input1 = input("Number 1> ")
  27. input2 = input("Number 2> ")
  28. number1 = int(input1)
  29. number2 = int(input2)
  30. result = number1 * number2
  31. output = str(result)
  32. print(input1 + " * " + input2 + " = " + output)
  33. #division
  34. elif command == "divide":
  35. print("lets divide some numbers")
  36. input1 = input("Number 1> ")
  37. input2 = input("Number 2> ")
  38. number1 = int(input1)
  39. number2 = int(input2)
  40. result = number1 / number2
  41. output = str(result)
  42. print(input1 + " / " + input2 + " = " + output)
  43. else:
  44. print("sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement