172. Python Program to Write a Shopping List to a File
EasyWrite
Overview
write() doesn't start a new line for you: add the "\n" yourself.
Problem Statement
Read one line with shopping items separated by spaces. Write each item into a file called shopping.txt, one item per line. Then open the file again, read it, and print what's in it.
Your program runs in the browser, so the file lives only in this tab's memory. Create it with "w" before you read it.
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One line of items, separated by spaces. Example:
bread milk eggs
Output
The file's text, one item per line:
bread
milk
eggs
The tests try 3 different lists, one of them with a single item.