What is self in Python?
self refers to the current instance of the class. It is used to access instance variables and methods inside the class.
Example:
class Student:
def __init__(self, name):
self.name = name
Here, self.name refers to the object's own variable.
Interview Tip:
A common answer interviewers expect is:
"self is used to represent the current object of the class."