Sort the code

Report a typo

In this task, you have to sort the lines of the code given below. Mind that first we need to create a list of animals.

Put the items in the correct order
animals = ['cat\n', 'dog\n', 'hamster\n']
animal_file = open('animals.txt', 'w', encoding='utf-8')
animal_file.close()
animal_file.writelines(animals)
___

Create a free account to access the full topic