Advertisement
jhoward48

Untitled

Jun 3rd, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.31 KB | None | 0 0
  1. print ("Hi, I am bot, Jacqueline, your friendly robot")
  2. command =input ("how can i help? Choose from: add, take away, shopping or average")
  3. if command== "add" or command == "+":
  4.      
  5.      print(" let's get started")
  6.      users_name=input("what is your name")
  7.      print("Welcome " ,users_name, "to the game")
  8.      input1 = int(input("Number 1> "))
  9.      input2 = int(input("Number 2> "))
  10.      input3 = int(input("Number 3> "))
  11.      result = input1 + input2 +input3
  12.      print( input1, " + " ,input2, "+ ", input3,  " = ", result)
  13.  
  14. elif command == " take away" or command == "-":
  15.      input1 = int(input("Number 1> "))
  16.      input2 = int(input("Number 2> "))
  17.      input3 = int(input("Number 3> "))
  18.      result = input1 - input2 -input3
  19.      print( input1, " - " ,input2, "- ", input3,  " = ", result)
  20. elif command == "average":
  21.      number=int(input(" How many numbers do you want to calculate the average of?"))
  22.      list=[]
  23.  
  24.      for i in range(number):
  25.                x=int(input(" what is the number you want to average"))
  26.                list.append(x)
  27.                total =sum(list)
  28.                print (" the running total of your list is ", total)
  29.                
  30.      print (" At the end of the program your total is ", total)
  31.      average =total/number
  32.      print (" the average of your numbers is ", average)
  33. elif command == "Shopping" or command == "shopping":
  34.      number= int(input(" how many items do you want in your shopping list?"))
  35.      shopping=[]
  36.      cost=[]
  37.      for item_number in range(number):
  38.           item =input(" what is item number "+str(item_number)+"?")
  39.           shopping.append(item)
  40.           price=float(input( " What is the price of " + (item)))
  41.           cost.append(price)
  42.           total =sum(cost)
  43.           average =(total /number)
  44.      if total>10:
  45.           discount = total/10
  46.           new_cost =  total- discount
  47.           new_average =new_cost/number
  48.  
  49.           print (" Your shopping bill is a total of " , new_cost,  " with a discount of ", discount,  "and the average price of an item was ", average, " pounds and pence")
  50.  
  51.      else:    
  52.           print (" Your final bill, without any discount,  is a total of ", total, " with an average of ", average,  "  and it has  ", len(shopping), ", items in it")
  53.  
  54. else:
  55.      print ("Sorry i am not sure what to do")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement