Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.09 KB | None | 0 0
  1. print("Hi, I am Scott, your personal bot and I love Maths.Hope you do too.")
  2. # ask the user to input a command
  3. command = input ("How can I help amigo?")
  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. elif command == "subtract":
  14.     print("lets subtract some numbers")
  15.     input1 = input("Number 1> ")
  16.     input2 = input("Number 2> ")
  17.     number1 = int(input1)
  18.     number2 = int(input2)
  19.     result = number1 - number2
  20.     output = str(result)
  21.     print(input1 + " - " + input2 + " = " + output)
  22. elif command == "multiply":
  23.     print("lets multiply some numbers")
  24.     input1 = input("Number 1> ")
  25.     input2 = input("Number 2> ")
  26.     number1 = int(input1)
  27.     number2 = int(input2)
  28.     result = number1 * number2
  29.     output = str(result)
  30.     print(input1 + " x " + input2 + " = " + output)
  31. elif command == "divide":
  32.     print("lets divide some numbers")
  33.     input1 = input("Number 1> ")
  34.     input2 = input("Number 2> ")
  35.     number1 = int(input1)
  36.     number2 = int(input2)
  37.     result = number1 / number2
  38.     output = str(result)
  39.     print(input1 + " / " + input2 + " = " + output)
  40. elif command == "average":
  41.     how_many = input("how many numbers> ")
  42.     how_many = int(how_many)
  43.     total = 0
  44.     for number_count in range (how_many):
  45.         number = input("Enter number " + str(number_count) + "> ")
  46.         total = total + int(number)
  47.     result = total / how_many
  48.     print("the average = " + str(result))
  49. elif command == "create a shopping list":
  50.     shopping = []
  51.     how_many = input("how many items of shopping do you have?")
  52.     how_many = int(how_many)
  53.     for item_number in range(how_many):
  54.         item = input("what is the item number " + str(item_number) + "? ")
  55.         shopping.append(item)
  56.     print(shopping)
  57.     print("you have got " + str(how_many) + " items in your shopping list")    
  58. else:
  59.     print("sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement