Learn Before
Code

Code Example for init() method

class Employee: def __init__(self, id): self.id = id

The __init__ method is used to assign a value to id during the creation of the object.

emp1 = Employee(5)

0

1

Updated 2021-02-03

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science