help with how to write to file in python using user input to write to .txt
def add_student(): (sName) = input("ID: ") (sMajor) = input("Major: ") (gPa) = input("GPA: ") students_file = open ('students.txt', 'a') students_file.write(sName) students_file.write(sMajor) students_file.write(gPa) students_file.close() this is what I have I'm writing a program that writes input to a students.txt file but I'm having trouble in the txt file it writes everything together I can get it to skip lines if I hard code the input in the students_file.write("413052"+"\n"+"Biology" etc) but as you can see above I need it to be the users input that writes to the file not hard coded and Ive been trying different things I thought that students_file.writlines(sName+"\n"+sMajor+"\n) would work but it doesn't can anybody give me some advice or help?