Python 3.4 - Init

The init function is odd but it will run automatically, first for any object in a class. To create the init function you need this: __init__ (two underscores on each side).



class Lakers:

    def __init__(self):
        print('Hey man ...Hey...!')

    def lose(self):
        print('Loser!')

laker1 = Lakers()

laker1.lose()

https://www.youtube.com/watch?v=G8kS24CtfoI

Comments

Popular posts from this blog

Python 3.4 - Caesar Cipher

UML - Use Case Diagram