Advertisement
sadennison

Python Week 2 Task 2.14

Jul 29th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #Scott the calculator
  2. #Main functions are subtract, divide, multiplication and addition
  3. print("Hi, I am Scott, your personal bot.")
  4. command = input("How can I help? Choose from Add, Sub, Multi or Div ")
  5. if command == "add" or command == "Add":
  6. print("lets add some numbers")
  7. input1 = input("Number 1> ")
  8. input2 = input("Number 2> ")
  9. number1 = int(input1)
  10. number2 = int(input2)
  11. result = number1 + number2
  12. output = str(result)
  13. print(input1 + " + " + input2 + " = " + output)
  14. elif command == "sub" or command == "Sub":
  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. elif command == "Multi" or command == "multi":
  24. print("lets subtract some numbers")
  25. input1 = input("Number 1> ")
  26. input2 = input("Number 2> ")
  27. number1 = int(input1)
  28. number2 = int(input2)
  29. result = number1 * number2
  30. output = str(result)
  31. print(input1 + " + " + input2 + " = " + output)
  32. elif command == "Div" or command == "div":
  33. print("lets subtract some numbers")
  34. input1 = input("Number 1> ")
  35. input2 = input("Number 2> ")
  36. number1 = int(input1)
  37. number2 = int(input2)
  38. result = number1 / number2
  39. output = str(result)
  40. print(input1 + " / " + input2 + " = " + output)
  41. else:
  42. print("Sorry, I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement