3. Writing


3. Writing

I try to save & submit, but it tells me that there is an error with the syntax. The terminal pops up with:

File "python", line 9
SyntaxError: invalid syntax

I have tried logging out, shutting down, and trying again later to no avail. Beyond frustrating.

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:
    my_file.write("%s\n" % (str(i))



Well that's embarassing... missed a bracket. Why would it tell me that the syntax is toast at the close command though?


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