The following code shows how to Example to Create a Class in Python.
# Defining a class in python class Institute: def __init__(self, iname, no_of_courses, established): self.iname=iname self.no_of_courses=no_of_courses self.established=established def getIname(self): print("Institute Name: "+self.iname) def getCourses(self): print("Number of courses in the institute: "+str(self.no_of_courses)) def getEstablished(self): print("Institute established in the year "+str(self.established)) # creating an object in python iob=Institute('IT Institute', 6, 2002) print("What is the name of this institute?") iob.getIname() print("How many courses are there in this institute?") iob.getCourses() print("In which year it is established?") iob.getEstablished()