como usar o Self no python 1

como usar o Self no python

def __init__(self):
   self.mtd([1, 2, 2, 3, 3, 3, 4, 4, 4, 4])

def mtd(self, data):
   for value in data:
       print(value)

Here is what the above code is Doing:
1. The class definition is executed.
2. The __init__ method is executed.
3. The mtd method is executed.
4. The __init__ method is finished.
5. The mtd method is finished.
6. The class definition is finished.

Similar Posts