How to append new data onto a new line

My code looks like this:

def storescores():

   hs = open("hst.txt","a")
   hs.write(name)
   hs.close() 

so if I run it and enter “Ryan” then run it again and enter “Bob” the file hst.txt looks like

RyanBob 

instead of

Ryan
Bob

How do I fix this?

Leave a Comment