Problem 1 (write list to file): Write and test a function with two parameters, one for a file object and one for a list. The function will write each item of the list entered as a parameter to one line of the file. Use a list traversal algorithm to write each list item to the file.
Testing your function:
T RE-11-22-CSCI120C-11-2-1
Create a list of your favorite pets and write those to a file named "myFavPets.txt".
Create a list of your favorite colors and write those to a file named "myFavColors.txt".
Problem 2 (change file format): Write and test a function with two parameters. The parameters represent file objects, the first one opened for reading (input file) and the second one opened for writing (output file).
The function will read each line of the input file, concatenate the string "Line" and the line number (starting at number 1) before the line's text, and write it to the output file.
Test your function using the file "boysNames.txt" as your input file and write to a file named "namesWithCounter.txt". To confirm that your program works correctly, you must compare your input and your output file.
Problem 3 (filter file contents): Write and test a function with two parameters. The parameters represent file objects, the first one opened for reading (input file) and the second one opened for writing (output file).
The function will read each line of the input file and write those lines that contain the letters X or Z to the output file.
Test your function using the file "boysNames.txt" as your input file and write to a file named "namesWithXZ.txt".