November 2018
Beginner
330 pages
7h 21m
English
Let's add a file to our repository, animals/lion.py:
"""A lion."""import animalclass Lion(animal.Animal): def __init__(self): self.kind = 'lion' def get_kind(self): return self.kind
Next let's add a bit to animal_farm.py that invokes the file (the added lines are highlighted in bold):
...from animals import dogfrom animals import lionfrom animals import sheep... if kind == 'dog': return dog.Dog() if kind == 'lion': return lion.Lion() if kind == 'sheep': return sheep.Sheep()...
You can check the status of your files (to see which changes are going to make it into a commit) by running the following command:
$ git status
The output of the command will show you that you swap animal_farm.py repository ...
Read now
Unlock full access