Advertisement
sadennison

Array List Task

Feb 26th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #Ask how many items of shopping are needed.
  2. #Collect the items and store them in a list.
  3. #Loop through the shopping list and display them.
  4. #Show a total at the end so the user can see how many have been added
  5. count = 0
  6.  
  7. shopping = []
  8.  
  9. how_many = input("how many items of shopping do you have? ")
  10. how_many = int(how_many)
  11.  
  12. for item_number in range(how_many):
  13. item = input("what is item number " + str(item_number) + "? ")
  14. shopping.append(item)
  15. count = count + 1
  16. output = str(count)
  17.  
  18. print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement