My code is working as expected, but I'm not sure why. As far as I can tell, "my_file" hasn't been defined anywhere, so I don't know why it is working when I call it. My best guess is that each exercise is using the previous exercise's code and storing it in the background somehow; is this the case? If not why is my_file working.
with open("text.txt","w") as textfile: textfile.write("blablablabla") if my_file.closed == False: my_file.close() print my_file.closed