class Averager:
    def __init__(self):
        self.numbers = []

    def add(self, num):
        self.numbers.append(num)

    def get_avg(self):
        if not self.numbers:
            return 0
        return sum(self.numbers) / len(self.numbers)
        
avg = Averager()

avg.add(10)
avg.add(20)
avg.add(30)

result = avg.get_avg()
print("평균:", result)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: