I am doing a program about creating a file about golf, it allows only one For. When I run the program I get an error about Golf_File.write(Name + ("\n") ValueError: I/O operation on closed file.
Num_People = int(input("How many golfers are playing?: "))
Golf_File = open('golf.txt', 'w')
for count in range(1,Num_People+1):
Name = input("Enter the player's name: ")
Score = int(input("Enter the player's score: "))
Golf_File.write(Name + ("\n"))
Golf_File.write(str(Score) + ("\n"))
Golf_File.close()