Advertisement
Guest User

Mathbot

a guest
Feb 22nd, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.30 KB | None | 0 0
  1. print ("Hi, I am Evelyn, your personal bot. Let's get started.")
  2. users_name = input("What is your name?")
  3. print ("Welcome, " + users_name + "!")
  4. print ("Let's do some calculations! I like addition.")
  5.  
  6. # Addition with 2 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.  
  15. # Addition with 3 numbers
  16. print ("We can also do some advanced calculations. First, let's add three numbers!")
  17. input3 = input("Number 3:")
  18. input4 = input("Number 4:")
  19. input5 = input("number 5:")
  20. number3 = int(input3)
  21. number4 = int(input4)
  22. number5 = int(input5)
  23. result = number3 + number4 + number5
  24. output = str(result)
  25. print (input3 + "+" + input4 + "+" + input5 + " = " + output)
  26.  
  27. # Subtraction with 2 numbers
  28. print ("I can also do subtractions.")
  29. input6 = input("Number 6:")
  30. input7 = input("Number 7:")
  31. number6 = int(input6)
  32. number7 = int(input7)
  33. result = number6 - number7
  34. output = str(result)
  35. print (input6 + "-" + input7 + " = " + output)
  36.  
  37. # Squares
  38. print ("I'm also very good at squares. I can show you right now.")
  39. input8 = input("Number 8:")
  40. number8 = int(input8)
  41. result = number8 * number8
  42. output = str(result)
  43. print (input8 + "*" + input8 + "=" + output)
  44.  
  45. # area of a circle
  46. print ("One of my awesome skills is calculating stuff you can't do in your head. Let's find out the area of a circle!")
  47. input9 = input("Please tell me the radius of the circle...")
  48. number9 = int(input9)
  49. number10 = float(3.1415926)
  50. input10 = str(number10)
  51. result = number10 + number9 + number9
  52. output = str(result)
  53. print (input10 + " * " + input9 + " * " + input9 + " = " + output)
  54. print ("See? Calculating is definitely one of my strong sides.")
  55.  
  56. # asking the user
  57. print ("I have more skills.")
  58. input11 = input("What do you wnat to do now?")
  59.  
  60. # Addition with 2 numbers
  61. if input11 == "Addition" or input11 == "Adding" or input11 == "add":
  62.   input12 = input("Number 1:")
  63.   input13 = input("Number 2:")
  64.   number9 = int(input12)
  65.   number10 = int(input13)
  66.   result = number1 + number2
  67.   outcome = str(result)
  68.   print (input12 + "+" + input13 + "=" + outcome)
  69.  
  70. # Subtraction with 2 numbers
  71. elif input11 == "Subtraction" or input11 == "Subtracting" or input11 == "subtract":
  72.   input14 = input("Number 1:")
  73.   input15 = input("Number 2:")
  74.   number11 = int(input14)
  75.   number12 = int(input15)
  76.   result = number3 - number4
  77.   outcome = str(result)
  78.   print (input14 + "-" + input15 + "=" + outcome)
  79.  
  80. # Multiplication with 2 numbers
  81. elif input11 == "Multiplication" or input11 == "Multiplying" or input11 == "multiply":
  82.   input16 = input("Number 1:")
  83.   input17 = input("Number2:")
  84.   number13 = int(input16)
  85.   number14 = int(input17)
  86.   result = number13 * number14
  87.   outcome = str(result)
  88.   print (input16 + "*" + input17 + "=" + outcome)
  89.  
  90. # Division with 2 numbers
  91. elif input11 == "Division" or == input11 == "Dividing" or input11 == "divide":
  92.   input18 = input("Number 1:")
  93.   input19 = input("Number 2:")
  94.   number15 = int(input18)
  95.   number16 = int(input19)
  96.   result = number15 / number16
  97.   outcome = str(result)
  98.   print (input18 + "/" + input19 + "=" + outcome)
  99.  
  100. # Every other answer
  101. else:
  102.   print ("Sorry, I don't understand that. Please try again.")
  103. print ("Very good. I like math.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement