Lab . Assignment
Lab . Assignment
ID : 25867
Section : BSAI . EF
Lab Assignment
Q1: Explain the basic concepts of OOP such as the following with example in code.
1. Class
2. Object
3. Method
4. Constructor (_init_)
5. self keyword
3. Method
A method is a function defined inside a class. It performs actions using the object's data.
4. Constructor (__init__ method)
The constructor is a special method called automatically when an object is created. It's defined
using __init__.
5. self keyword
In Python, self refers to the current object (instance) of the class. It is used to:
3. A method called display_info that prints the student's name and marks.