I am facing an unique issue, my code matches exactly to what people have claimed in previous queries that seems to work for them.

The console shows an error for me and the output.txt is completely blank, even then I got a message with the green tab to proceed.

I tried resetting the code and working with it again, but nothing has changed.

my_list = [i**2 for i in range(1,11)]

my_file = open("output.txt", "r+")

# Add your code below!
for i in my_list:
    <img src="//codecademy-discourse.s3.amazonaws.com/original/5X/d/8/c/8/d8c8caae861ba7586c7ff0f448c41f89fc017b79.png" width="690" height="388">


Hi @sandesh09dec,

Have you tried this, instead, for opening the file? ...

my_file = open("output.txt", "w+")


Slightly off topic, does "w+" overwrite the file contents?


"w+" opens the file for reading and writing. If the file does not exist, it creates the file. If it does exist, it truncates the file, so, yes, it does get overwritten.


Yeah that solves the problem. Great!!