F.closed() is not working

i wrote as–>
with open(“sample.txt”,“r”) as f:
print(f.closed())
print(f.read())

it is giving TypeError Traceback (most recent call last)
in
1 with open(“file.txt”,“r”) as f:
----> 2 print(f.closed())
3 print(f.read())

TypeError: ‘bool’ object is not callable

You should remove brackets from the f.closed and than it will run fine.

Hope this helped :blush: