obj=student() #invoking attribute inside the class print(obj.attr1) #invoke method through objects obj.fun() class csstudent: #class variable stream='cse' #init method def __init__(self,name,roll): self.name=name self.roll=roll #instance variable
#objects for the class
a=csstudent("student",101) b=csstudent("cuca",102) #invoking my class variable using the object print(a.stream) print(b.stream) print(a.name) print(b.name) print(a.roll) print(b.roll) #invoking my class variable using the class Name print(csstudent.stream)