Advertisement
Roddyn

shopping_list_explanation

Dec 17th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. shopping = []#create a list called shopping
  2.  
  3. for item_number in range(5):#create a loop that repeats 5 times
  4. item = input("what is item number " + str(item_number) + "? ")#ask the user to enter an item onto the list convert item_numbervariable into a string
  5.  
  6. shopping.append(item)#add users item to the list
  7.  
  8. print(shopping)#print out the shopping list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement