Im making a program that will ask the user for their first name and surname. This data is then saved to a .txt file. I understand that the coding is basic and easy to understand but just recently this code has decided to not work.
file1 = open("document.txt",'w')
firstname = input("What is your first name?")
secondname = input("what is you second name?")
file1 = open ('document.txt','w')
file1.write (firstname + secondname)
newfile.close()
I am given the following error when running this piece of code