# open the file in "write" mode # (meaning if the file doesn't exist yet, create it) out_file = open("countdown.txt", "w") for i in range(10, 0, -1): # write() only takes strings, so we need to convert # our variable i into a string. # write also doesn't add line breaks, so we need to # include the newline character: "\n" ourselves out_file.write(str(i) + "\n") out_file.write("Liftoff!") out_file.close()