♦ Python Class
♣ About Python Class
Class gives skeleton for developing major(including minor) Data Structures.Class consists of attributes and methods.
♣ Example1: Creating a Class in Python
At the very beginning, skeleton(attributes and methods) of the Class is to be defined."class" keyword is used to define the class in python.
Example
Input:
Output:
♣ Example2: Initializing an Object in Python
After defining skeleton for class, objects for the class are to be initialized so that it can be used in applications. Example
Input:
Output:
♣ Example3: __init__() function in Python
__init__() is a Class defined function, which is always executed when an instance of the Class Object is initiated.The __init__() function can be used to assign values to object properties.
Example
Input:
Output: