#How to create and write to a file #Makes use of "write" i.e. it will overwrite the file if #the file exists def main(): carval = input('Name a car:') carlist = [] #just ask for a list of cars from the user while carval != "done": carlist.append(carval) carval = input('Name a car (or type done to end): ') #this is what we normally do and spit stuff out to the console for c in carlist: print(c) #let's save to a file with open('/home/isqsdac/Desktop/workspace/l3_1/carlist.txt', 'w') as f: for c in carlist: f.write(c) f.write('\n') main()