예제 #1
0
import animals 

#Create an object of Mammals class and call a mathod of it
myMammal = animals.Mammals()
myMammal.printMembers()

#Create an object of Birds class and call a mathod of it
myBird = animals.Birds()
myBird.printMembers()

myFish = animals.Fish()
myFish.printMembers()
예제 #2
0
# Import classes from your brand new package
#from animals import Mammals
#from animals import Birds
#import animals

# Create an object of Mammals class & call a method of it
#myMammal = animals.Mammals()
#myMammal.printMembers()

# Create an object of Birds class & call a method of it
#myBird  = animals.Birds()
#myBird.printMembers()

import animals

m = animals.Mammals()
m.printMembers()

b = animals.Birds()
b.printMembers()

f = animals.Fish()
f.printMembers()

예제 #3
0
import animals
import os
# Создаем объекты Birds
goose_s = animals.Birds('Гусь', 'Серый', 'кря-кря', 10, 15)
goose_w = animals.Birds('Гусь', 'Белый', 'кря-кря', 9, 8)
chicken_ko = animals.Birds('Курица', 'Ко-ко', 'КУКАРЕКУУУ', 10, 15)
chicken_ky = animals.Birds('Курица', 'Ку-ка-реку', 'КУКАРЕКУУУ', 8, 11)
duck = animals.Birds('Утка', 'Кряква', 'кря-кря-кря', 7, 0)

# Создаем объекты Cattle
cow = animals.Cattle('Корова', 'Манька', 'Муууу', 135, 30)
goat_r = animals.Cattle('Коза', 'Рога', 'Бее-бее', 80, 12)
goat_k = animals.Cattle('Коза', 'Копыта', 'Бее-бее', 90, 18)

# Создаем объекты Sheep
sheep_b = animals.Sheep('Овца', 'Барашек', 'Беее', 37, 20)
sheep_k = animals.Sheep('Овца', 'Кудрявый', 'Беее', 46, 15)


# Функция начала
def start():
    print('ЖИВОТНЫЕ НА ФЕРМЕ ДЯДИ ДЖО')
    print('===========================')
    print(f'На ферме дяди Джо бегают животные:')
    # Птицы
    print(f'\nПтички: ')
    print(f'{goose_s.get_type()}, которого зовут {goose_s.get_name()}')
    print(f'{goose_w.get_type()}, которого зовут {goose_w.get_name()}')
    print(f'{chicken_ko.get_type()}, которого зовут {chicken_ko.get_name()}')
    print(f'{chicken_ky.get_type()}, которого зовут {chicken_ky.get_name()}')
    print(f'{duck.get_type()}, которого зовут {duck.get_name()}')
예제 #4
0
import animals

m = animals.Mammals()
m.printMembers()
"""
b = animals.Birds()
b.printMembers()

f = animals.Fish()
f.printMembers()
"""
harmless_birds = animals.Birds()
harmless_birds.printMembers()

dangerous_fish = animals.Fish()
dangerous_fish.printMembers()