Posts

Showing posts from August 7, 2021

Using class objects, Instance variables, and class variables, class methods and static method in python

  Using class objects, Instance variables, and class variables, class methods and static method in python Code - ------------------------------------ class Students:     number_of_buildings = 4     # def Majra(self):     #     return f"Number of toys are {self.toys}, and number of buildings are {self.number_of_buildings}"     def __init__(self, name, aclass, section, rollnumber, school, stream):         self.name = name         self.standard = aclass         self.section = section         self.Roll_number = rollnumber         self.School = school         self.stream = stream     def eye_checker(self):         return f"Class is {self.standard}, and name is {self.name}"     @classmethod     def hello(cls, no_of_new_buildings):         cls.numb...