Spot the wrong one

Report a typo

Which of the following is an incorrect way of working with files?

a)

file = open('test_file.txt', 'w')
file.write('file 1')

b)

with open('test_file.txt', 'w') as file:
    file.write('file 2')
    file.close()

c)

with open('test_file.txt', 'w') as file:
    file.write('file 3')

d)

file = open('test_file.txt', 'w')
file.write('file 4')
file.close()
Select one option from the list
___

Create a free account to access the full topic