Header Ads Widget

Python program to count number of objects of a class.

 Here first we create a class Student and then we will create some objects of this class . 
In this question we have to find that how many objects of the class Student are exit.
So let's start the coding


# student class
class Student:
def __init__(self):

# object 1
# object 2
# object 3
print("Total number of objects of the class is : ",Student.count)


 Here the output will be the  total number of objects which we created in the program . As we can see here we are creating three objects s1, s2, and s3 . So the output of the program will be 3 . lets check what will be the output of the program.

Total number of objects of the class is : 3

See more:-

1) Very Cool numbers | Hacker earth solution

2) Birthday party | Hacker earth solution