From e87fc3780a0c8b93e5257121a5a7efa459fe4b94 Mon Sep 17 00:00:00 2001 From: BarsTigerMeowcat Date: Fri, 13 Mar 2020 14:25:18 +0200 Subject: [PATCH] 1 --- Zverushka/ZverushkaWithKlassovoVernim.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Zverushka/ZverushkaWithKlassovoVernim.py b/Zverushka/ZverushkaWithKlassovoVernim.py index ded150f..49d1d5b 100644 --- a/Zverushka/ZverushkaWithKlassovoVernim.py +++ b/Zverushka/ZverushkaWithKlassovoVernim.py @@ -1,16 +1,23 @@ class Critter(object): + total = 0 + + @staticmethod + + def status(): + print("\nВсего зверюшек сейчас", Critter.total) + def __init__(self, name): print("Появилась на свет новая зверюшка!") self.name = name + Critter.total += 1 + + +print("Нахожу значение атрибута клсса Critter.total:", end= " ") - def talk(self): - print("Привет. Я - зверюшка - экземпляр класса Critter.") crit1 = Critter("Барсик") -crit1.talk() crit2 = Critter("Шарик") -crit2.talk() print("Вывод объекта crit1 на экран: ") print(crit1)