File I/O Exercise
From WLCS
Objective:
- You will be creating a program that prompts the user to enter a bunch of names, which will be written to a file.
- You will also create another program that reads the contents of a particular file, and allows the user to search for a particular name.
Resources:
File Output Program:
- Using a loop, you will continuously prompt the user to enter a name
- After the user inputs the name, you will append it to a list of names
- If the user ever inputs nothing, then you will break out of the loop or end the loop
- You should prompt the user to enter a filename to be used
- Create a new file to write out to, using the filename provided by the user
- Your program should traverse the list of names and write out to file, every name in the file
- Close your file
File Input Program:
- Prompt the user to enter a filename
- Open the file for reading
- Read all of the contents of the file into a list
- Prompt the user to enter a name that they wish to search for
- Use a loop to traverse the list of names, and check if the name is found in the list
- You should output to the user whether or not the name is found in the list