Question: Write a python program ( using the starter file provided below ) that appends ( a mode ) data to an existing file ( players
Write a python program using the starter file provided below that appends a mode data to an existing file playerstxt Your program must:
open the file playerstxt
ask for information about your three additional players real or fictional
store the information in the file
close the file
reopen the file for reading r mode
read and print out each line
# Baseball players starter file players.py
def main:
# Open an output file, players.txtin append mode a
# Enter the player's number, name, and home runs for three additional players
# Store each player's data in the output file
outfile.writefnumber: dnamehrs: d
# Close the output file
outfile.close
# Reopen the file for input printing
# Print out the data for each player
# Close the input file
main
#players.txt file to modify
Shohei Otani
Aaron Judge
Babe Ruth
Ted Williams
Derek Jeter
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
