Writing


#1

Sneaky! The code that they give you at the top is incorrect. If you change "r+" to "w" on line 3 it works.

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

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

Add your code below!

for i in my_list:
my_file.write(str(i) + "\n")

my_file.close()


#2

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