Aequitas35

Math bot

Oct 17th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. print("Hi, I'm Marvin, your personal assistant.")
  2. your_name = input("What's your name?\n")
  3. print("Welcome " + your_name + "!")
  4. opr = input("How may I assist you with?\n")
  5. if opr == "add" or opr == "Add":
  6.     num1 = input("Enter first number.\n")
  7.     num2 = input("Enter second number.\n")
  8.     result = int(num1) + int(num2)
  9.     output = str(result)
  10.     print(num1 + "+" + num2 + "=" + output)
  11. elif opr == "substract" or opr == "Substract":
  12.     num1 = input("Enter first number.\n")
  13.     num2 = input("Enter second number.\n")
  14.     result = int(num1) - int(num2)
  15.     output = str(result)
  16.     print(num1 + "-" + num2 + "=" + output)
  17. elif opr == "multiply" or opr == "Multiply":
  18.     num1 = input("Enter first number.\n")
  19.     num2 = input("Enter second number.\n")
  20.     result = int(num1) * int(num2)
  21.     output = str(result)
  22.     print(num1 + "*" + num2 + "=" + output)
  23. elif opr == "divide" or opr == "Divide":
  24.     num1 = input("Enter first number.\n")
  25.     num2 = input("Enter second number.\n")
  26.     result = int(num1) / int(num2)
  27.     output = str(result)
  28.     print(num1 + "/" + num2 + "=" + output)
  29. else:
  30.     print("I'm not capable of doing " + opr + " at the moment. You should keep upgrading me.")
Advertisement
Add Comment
Please, Sign In to add comment