In this we are going to see a program on how to display result using multilevel inheritance in Python Programming Language.
class student:
def getStudent(self):
print("Enter your details: ")
self.name = input("Name: ")
self.age = input("Age: ")
self.gender = input("Gender: ")
class get_marks(student):
def getMarks(self):
print("Enter the marks (out of 100) of the respective subjects")
self.physics = int(input("Physics: "))
self.chemistry = int(input("Chemistry: "))
self.math = int(input("Math: "))
self.biology = int(input("Biology: "))
class marks(get_marks):
def display(self):
print("\n\nName: ",self.name)
print("Age: ",self.age)
print("Gender: ",self.gender)
print("Total Marks: ", self.physics + self.chemistry + self.math + self.biology)
m1 = marks()
m1.getStudent()
m1.getMarks()
m1.display()
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP