Exercise in question: https://www.codecademy.com/courses/python-intermediate-en-OGNHh/0/3?curriculum_id=4f89dab3d788890003000096#
Error I receive: Oops, try again. It looks like your file doesn't contain each element from my_list on its own line.
Desired Outcome: All numbers in the list should print to the output.txt file
Sometimes the code will "work" and print the numbers to the file, but then will also print a series of strings (output pasted below). When I run the code on my desktop version of python, it prints perfectly. This is the only variant of the code I can get to print anything at all while on the site.
Output file on CodeAcademy:
my_list = [i**2 for i in range(1,11)] my_file = open("output.txt", "r+") # Add your code below! for item in my_list: my_file.write("%s\n" %(str(item))) my_file.close()