Advertisement
Guest User

Shopping list

a guest
Jan 27th, 2020
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. print("Hi, I am a Marvin, your personal bot!")
  2. print("Let's get start it!")
  3. users_name=input("What is your name?")
  4. print("Hi, "+users_name+", Welcome!")
  5. print("Let´s make your shopping list")
  6. shopping = []
  7. how_many = input("How many items of shopping do you have? ")
  8. how_many = int(how_many)
  9. for item_number in range(how_many):
  10.     # use input to ask the user for something to go on the shopping list
  11.     item = input("What is the item number " + str(item_number) + "?")
  12.     # agregar al final de la lista
  13.     shopping.append(item)
  14.     count = 0
  15. for item in shopping:
  16.     print(item)
  17.     count = count + 1
  18.     result=str(count)
  19. print("You have " + result + " items in your shopping list")
  20.  
  21. total=0
  22. print("Calculating cost average")
  23. print("How much does each item cost?")
  24. for number_count in range(how_many):
  25.     number = input("Enter number "+str(number_count) + " > ")
  26.     total= total + int(number)
  27. result = total / how_many
  28. print("The average = "+str(result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement