Writing, succeeded with code, but output.txt is empty


#1



The code I wrote here below works, as in I got the green light.
But, when I look at the output.txt tab, it's empty. So it didn't write anything to it.

What's going on?


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

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

# Add your code below!
my_file.open()
for i in my_list:
    my_file.write("i\n")
    
my_file.close()


#2

never mind, it worked after i tried again.


#3

I think the file section doesn't work really good on CC

Install python on your computer and try it there


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.