LogiQuest
Back to Object Oriented Programming
21

What is the output of the following code?

class Bag:
    def __init__(self):
        self.items = [1, 2, 3]
    def __len__(self):
        return len(self.items)
print(len(Bag()))
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.