Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. #from origina bot
  2. print("Hi I am John's bot")
  3. #two new lines
  4. command = input("How can I help? ")
  5. if command == "add" or command == "Add" or command == "plus":
  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. print (result)
  13. output = str(result)
  14. print("or in full....")
  15. print(input1 + " + " + input2 + " = " + output)
  16. elif command == "subtract" or command == "Minus" or command == "minus":
  17. print("lets subtract some numbers")
  18. input1 = input("Number 1> ")
  19. input2 = input("Number 2> ")
  20. number1 = int(input1)
  21. number2 = int(input2)
  22. result = number1 - number2
  23. print (result)
  24. output = str(result)
  25. print("or in full....")
  26. print(input1 + " - " + input2 + " = " + output)
  27. #Your challenge is to update your program so it can:
  28. # • solve division or multiplication problems when given the commands “divide” or “multiply”.
  29. # • work out another problem you have chosen. This could be calculating an area, how much your weekly shopping costs, or anything else you like.
  30. elif command == "divide" or command == "div" or command == "div by":
  31. print("lets divide some numbers")
  32. input1 = input("Number 1> ")
  33. input2 = input("Number 2> ")
  34. number1 = int(input1)
  35. number2 = int(input2)
  36. result = number1 / number2
  37. print (result)
  38. output = str(result)
  39. print("or in full....")
  40. print(input1 + " / " + input2 + " = " + output)
  41. elif command == "multiply" or command == "times" or command == "times by":
  42. print("lets multiply some numbers")
  43. input1 = input("Number 1> ")
  44. input2 = input("Number 2> ")
  45. number1 = int(input1)
  46. number2 = int(input2)
  47. result = number1 * number2
  48. print (result)
  49. output = str(result)
  50. print("or in full....")
  51. print(input1 + " x " + input2 + " = " + output)
  52. #motivated by previous work on https://scratch.mit.edu/projects/306896953/
  53. elif command == "shape angles" or command == "polygon angles":
  54. print("Let's work out the internal angles of your polygon")
  55. input1 = input("How many sides does your polygon have?")
  56. #input2 = input("Number 2> ")
  57. number1 = int(input1)
  58. #number2 = int(input2)
  59. result = 180 - 360/number1
  60. print (result)
  61. output = str(result)
  62. print("or in full....")
  63. print(" Your " + input1 + " sided shape has internal angles of " + output + " degrees")
  64. else:
  65. print("Computer bot does not understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement