- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
A Simple class with init Method:
Explanation of the Below Code:
- We create a myself-named class.
- Then we define the init method with self and name parameters, then create an instance variable.
- Then we define a me-named method with a self-parameter, we take the instance variable in the print function which returns the instance variable value inside the given string (separate with a comma).
- Then we create a chirag-named instance(object) with one argument of myself class.
- Then we call the me method using the chirag-named instance(object).
- Get link
- X
- Other Apps
Comments
Post a Comment