Advertisement
xavicano

Untitled

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