Write a program in python with no imports namedfilemaker.py that will be used to store the first name and age of some friends in a text file namedfriends.txt. The program must use a while loop that prompts the user to enter the first name and age of each friend. Each of these entries should be written to its own line in the text file (2 lines of data per friend). The while loop should repeat until the user presses Enter (Return on a Mac) for the name. Then, the file should be closed and a message should be displayed. See Sample Output.SAMPLE OUTPUT
Enter first name of friend or Enter to quit DennyEnter age (integer) of this friend 24Enter first name of friend or Enter to quit PennyEnter age (integer) of this friend 28Enter first name of friend or Enter to quit LennyEnter age (integer) of this friend 20Enter first name of friend or Enter to quit JennyEnter age (integer) of this friend 24Enter first name of friend or Enter to quitFile was created
2. Now write a program namedfilereader.py that reads and displays the data in friends.txt. This program should also determine and print theaverage age of the friends on file. That will require anaccumulator and acounter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate toone decimal place. See the Sample Output..SAMPLE OUTPUT
ANSWER #2.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here