9/9 Case closed


#1

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 "THANKS GUYS"
else:
print "Maybe next time!"

cYa @ the next course :wink:


#2

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

with open("text.txt", "w") as my_file:
my_file.write("Success!")
f = open('my_file')
if f.closed:
print 'file is not closed'
elif f.close:
print 'file is closed'
print my_file.closed


#3

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:
f.close()
print f.closed


#4

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

Example:
with open("text.txt", "w") as my_file:
my_file.write("Holaaaaa")

if not my_file.close:
my_file.close()

print my_file.closed


#5

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:
        
        my_file.close()
 
print my_file.closed

#6

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.


#7

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


#8

What is wrong with my code??

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

#11

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


#12

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.


#13

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?


#15

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