9/9 Case closed

Finally, im finished…
Lots of thanks to the Codecademyteam for this nice course and looots of thanks to the Q&A Forum for a lot of help!

Mikemo = PythonPro

if Mikemo == PythonPro:
print “Maybe next time!”

cYa @ the next course :wink:


Im confused with the last exercise… am i missing something???

with open(“text.txt”, “w”) as my_file:
f = open(‘my_file’)
if f.closed:
print ‘file is not closed’
elif f.close:
print ‘file is closed’
print my_file.closed

Actually file was already closed before as we use with/as, so you may want to open it again:

with open(“text.txt”, “w”) as my_file:
my_file.write(“some text!”)
f = open(“text.txt”, “r”)
print f.closed
if f.closed != True:
print f.closed

1 Like

Is it better to write the if sentence this way:
if not my_file.close

with open(“text.txt”, “w”) as my_file:

if not my_file.close:

print my_file.closed

1 Like

Try the code below. I have to read the instructions twice to understand it

with open("text.txt", "w") as my_file:
    my_file.write("Finally able to write to a file")
    if not my_file.closed:
print my_file.closed
1 Like

Hip Hip Hurray!!! I am done with the Python course.

I wanna say a BIG THANK YOU to the codecademy team and the codecademy forum.

You all are wonderful.

Love you all.

Wanna start Java soon.

Once again, thanks to you all.


You could also take learn the command line & learn Git.

What is wrong with my code??

with open("text.txt","w") as my_file:
if my_file.closed == False :
print my_file.closed

1 Like

I also finished the Python course! Many thanks to CodeCademy and all the classmates for your help! All the best for everyone! :smiley:

Inside the if statement, your code to close the file should be:

my_file.close() <-- no ‘d’ at the end of ‘close’

You are mixing an attribute with a method.

BTW, thank you for the course. I’m not sure if it is already updated or not, but this is Python 2.xx. Will there be a Python 3.xx course in the future?

kys kys kys kys kys kys kys :older_woman::older_man::skull: