예제 #1
0
def make_animal(kind):
    if kind == 'cat':
        return cat.Cat()
    if kind == 'dog':
        return dog.Dog()
    if kind == 'sheep':
        return sheep.Sheep()
    return animal.Animal(kind)
예제 #2
0
def make_animal(kind):
    """Create an animal class."""
    if kind == 'cat':
        return cat.Cat()
    if kind == 'dog':
        return dog.Dog()
    if kind == 'sheep':
        return sheep.Sheep()
    return animal.Animal(kind)
예제 #3
0
def make_animal(kind):
    """make animal"""
    if kind == 'cat':
        return cat.Cat()
    if kind == 'dog':
        return dog.Dog()
    if kind == 'sheep':
        return sheep.Sheep()
    if kind == 'leopard':
        return leopard.Leopard()
    return animal.Animal(kind)
예제 #4
0
def create_animal(kind):
    """Create an animal class."""
    if kind == 'cat':
        return cat.Cat()
    if kind == 'dog':
        return dog.Dog()
    if kind == 'lion':
        return lion.Lion()
    if kind == 'leopard':
        return leopard.Leopard()
    if kind == 'sheep':
        return sheep.Sheep()
    return animal.Animal(kind)
예제 #5
0
import farm

def make_animal(kind):
    """Create an animal class."""
    if kind == 'cat':
        return cat.Cat()
    if kind == 'dog':
        return dog.Dog()
<<<<<<< HEAD
    if kind == 'lion':
	return lion.Lion()
=======
    if kind == 'leopard':
	return leopard.Leopard()
>>>>>>> feature-leopard
    if kind == 'sheep':
        return sheep.Sheep()
    return animal.Animal(kind)

def main(animals):
    animal_farm = farm.Farm()
    for animal_kind in animals:
        animal_farm.add_animal(make_animal(animal_kind))
    animal_farm.print_contents()

if __name__ == '__main__':
    if len(sys.argv) == 1:
        print('Pass at least one animal type!')
        sys.exit(1)
    main(sys.argv[1:])