9 case closed help me


#1

with open("text.txt", "w") as my_file:
my_file.write("jiea")
if my_file.closed ! == true
return my_file.close()
print my_file.closed


#2

you have a a bunch of mistakes. Here

with open("text.txt", "w") as my_file:
    my_file.write("jiea")
#!== is not a valid comparator in python
#!= is the correct comparator
if my_file.closed != True:
    # you called return here remember
    #you can only call return inside a function
    my_file.close()
print (my_file.closed)

#3

why did you put "()" last part ---> print (my_file.closed)


#4

i put the bracket because I am using python 3 on my computer locally. it is necessary to add the brackets in that version. Code academy uses python2.7, in that version you do not need the brackets