Write a program to input a list of grocery items for your shopping list and then writes them to a file a line at a time. The program should keep asking you to enter grocery items until you type 'done'
.
After you complete the list, the program should then load the file and read the list back to you by printing each item out.
Sample Run:
Let's make a shopping list. Type 'done' when you're finished:
Enter Item: milk
Enter Item: cheese
Enter Item: eggs
Enter Item: beer
Enter Item: apples
Enter Item: done
Your shopping list:
milk
cheese
eggs
beer
apples
In [ ]:
filename = "NYC2-shopping-list.txt"
## Step 2: write code here
In [2]:
## Step 4: Write program again with refactored code.
def readShoppingList():
shoppingList = []
# todo read shopping list here
return shoppingList
# TODO Main code here
Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?
To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.
Keep your response to between 100 and 250 words.
--== Write Your Reflection Below Here ==--