# File: tuThGroceries.py # Author: Dr. Gibson # Date: 9/29/2016 # Section: N/A # E-mail: k.gibson@umbc.edu # Description: # This file contains python code that asks the user for # their grocery items, save it in a list, and prints out # the final list at the end. def main(): groceries = [] # priming read item = input("What would you like to buy? ('STOP' to stop): ") # sentinel loop, in which we fill the list with groceries while item != "STOP": groceries.append(item) item = input("What would you like to buy? ('STOP' to stop): ") index = 0 # go through the list and print out the contents while index < len(groceries): # this tells us which index is being printed out, as well print("Printing groceries at", index, ":", groceries[index] ) index = index + 1 main()