3. Writing



The code below works, but I got this error message in the console:

Traceback (most recent call last):
File "python", line 3, in
IOError: [Errno 2] No such file or directory: 'output.txt'

What's causing it?

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

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

# Add your code below!
for v in my_list:


I get the same error, I am fairly certain it is a bug since that portion of the code is already there when you start the lesson.


use this: my_file.write("%s\n" % (v))


I already found a workaround, but thanks anyway!


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