Без возвращаемого значения

Классы / Методы

class Counter:
    def __init__(self):
        self.count = 0

    def inc_by(self, value):
        self.count += value

    def inc_by_amount(self, value, amount):
        self.count += value * amount


counter = Counter()
# No return: the call gives None
result = counter.inc_by(1)
# counter.count is 1
print(f"{result = }")
print(f"{counter.count = }")

counter.inc_by_amount(2, 5)
# counter.count is 11
print(f"{counter.count = }")