I have this program I am writing and it's supposed to only use one for. The for is needed to ask what the names and scores are. Also, the for is needed to write the scores and names to the file. I get an error when trying to run it saying "UnsupportedOperation: Not Readable"
Golf_File = open('golf.txt', 'w')
names = []
scores = []
for line in Golf_File:
input("Please enter a players name: ")
if name !='':
break
score = input("Please input the players score: ")
if name != '' and score !="":
golf.txt.write(name + "\n")(str(score) + "\n")
Golf_File.close()
EDIT =
for line in Golf_File:
Golf_File = open('golf.txt', 'w')
names = input("Please enter a players name: ")
score = input("Please input the players score: ")
Golf_File.write(str(names) + "\n")
Golf_File.write(str(scores) + "\n")
Golf_File.close()