Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #Ask how many items of shopping are needed.
  2.  
  3. number_of_items = input("How many items of shopping are needed? ")
  4.  
  5. number_of_items = str(number_of_items)
  6.  
  7. print("So you're planning to include " + number_of_items + " items in your shopping list.")
  8.  
  9. #Collect the items and store them in a list.
  10.  
  11. shopping = []
  12. count = 0
  13.  
  14. number_of_items = int(number_of_items)
  15.  
  16. for item_number in range(number_of_items):
  17. item = input("What is item number " + str(item_number + 1) + "? ")
  18. shopping.append(item)
  19. count = count + 1
  20.  
  21. #Loop through the shopping list and display them.
  22.  
  23. for item_number in shopping:
  24. print(item)
  25.  
  26.  
  27. #Show a total at the end so the user can see how many have been added.
  28.  
  29. count = str(count)
  30. print("Your shopping list includes " + count + " items.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement