class Clovek:
# static field
people_count = 0
@staticmethod
def howmany():
Clovek.people_count
# a constructor
def __init__(self, name, age):
self.name = name
self.age = age
Clovek.people_count += 1
# getter
def getName(self):
return self.name
def getAge(self):
return self.age
# a method
def whoami(self):
print(f"Hello, my name is {self.name}, I am {self.age} years old.")
dan = Clovek("Daniel", 31)
dan.whoami()
simon = Clovek("Simon", "?")
simon.whoami()
print(f"Number of people: {Clovek.howmany()}")