Classes and fuctions

at the time of the construction creation, we write:-

def__init__(self,pname,clg):
self.name=pname
self.colldge=clg…

so what happening on doing self.name=pname …mtlb how it get value

and second thing …

at the time of function creation or constructor creation, self keyword is compulsory

2

init function represents the constructor of the class given to you and self argument is compulsory to pass in order to represent that object and here self.name=pname it is just assigning the value of pname to the name variable of the class which we can access using self.name. Hope you will understand and if case of any confusion pls ask !! Happy Coding !! :slight_smile: