Advertisement
xavicano

Untitled

Oct 13th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.11 KB | None | 0 0
  1. # BOT Presentation Shopping
  2. print("Hi, I am Marvin, your personal bot.")
  3.  
  4. #input to ask which opetarion you want to do
  5. command = input("How can I help? ")
  6.  
  7. # if operation is add else substract
  8. if command == "add":
  9.     print("lets add some numbers")
  10.     input1 = int(input("Number 1> "))
  11.     input2 = int(input("Number 2> "))
  12.     result = input1 + input2
  13.     #operates with the input and print result
  14.     print(input1," + " ,input2," = " ,result)
  15. elif command == "subtract":
  16.     print("lets subtract some numbers")
  17.     input1 = int(input("Number 1> "))
  18.     input2 = int(input("Number 2> "))
  19.     #operates with the input and print result
  20.     result = input1 - input2
  21.     print(input1," - " ,input2," = " ,result)
  22. elif command == "multiply":
  23.     print("lets subtract some numbers")
  24.     input1 = int(input("Number 1> "))
  25.     input2 = int(input("Number 2> "))
  26.     #operates with the input and print result
  27.     result = input1 * input2
  28.     print(input1," * " ,input2," = " ,result)
  29. elif command == "divide":
  30.     print("lets subtract some numbers")
  31.     input1 = int(input("Number 1> "))
  32.     input2 = int(input("Number 2> "))
  33.     #operates with the input and print result
  34.     result = input1 / input2
  35.     print(input1," / " ,input2," = " ,result)
  36. elif command == "average":
  37.   how_many = input("How many numbers> ")
  38.   how_many = int(how_many)
  39.   total = 0
  40.   for number_count in range(how_many):
  41.       number = input("Enter number " + str(number_count) + "> ")
  42.       total = total + int(number)
  43.   result = total / how_many
  44.   print("the average = " + str(result))
  45. elif command=="discount":
  46.   how_many = int(input("Which is the price > "))
  47.   discount = int(input("Which is the discount > "))
  48.   print ("The discount is ",discount/100*how_many," and the final prices is", how_many*(1-discount/100))
  49. elif command=="meal":
  50.   print("Let's calculate the cost of meal")
  51.   how_many = int(input("How many you are > "))
  52.   discount = int(input("Which is the addition value > "))
  53.   print ("The price per person is",discount/how_many )
  54. else:
  55.     print("sorry I dont understand")
  56.     #print polite error message in case nothing matchs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement