Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Hi, I am bot, Jacqueline, your friendly robot")
- command =input ("how can i help? Choose from: add, take away, shopping or average")
- if command== "add" or command == "+":
- print(" let's get started")
- users_name=input("what is your name")
- print("Welcome " ,users_name, "to the game")
- input1 = int(input("Number 1> "))
- input2 = int(input("Number 2> "))
- input3 = int(input("Number 3> "))
- result = input1 + input2 +input3
- print( input1, " + " ,input2, "+ ", input3, " = ", result)
- elif command == " take away" or command == "-":
- input1 = int(input("Number 1> "))
- input2 = int(input("Number 2> "))
- input3 = int(input("Number 3> "))
- result = input1 - input2 -input3
- print( input1, " - " ,input2, "- ", input3, " = ", result)
- elif command == "average":
- number=int(input(" How many numbers do you want to calculate the average of?"))
- list=[]
- for i in range(number):
- x=int(input(" what is the number you want to average"))
- list.append(x)
- total =sum(list)
- print (" the running total of your list is ", total)
- print (" At the end of the program your total is ", total)
- average =total/number
- print (" the average of your numbers is ", average)
- elif command == "Shopping" or command == "shopping":
- number= int(input(" how many items do you want in your shopping list?"))
- shopping=[]
- cost=[]
- for item_number in range(number):
- item =input(" what is item number "+str(item_number)+"?")
- shopping.append(item)
- price=float(input( " What is the price of " + (item)))
- cost.append(price)
- total =sum(cost)
- average =(total /number)
- if total>10:
- discount = total/10
- new_cost = total- discount
- new_average =new_cost/number
- 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")
- else:
- 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")
- else:
- print ("Sorry i am not sure what to do")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement