We will create a class named Media which is inherited by two classes Magazine and Channel. Then we have used the get method to get input of information from the user. And then print the details using the print method.
Enter Magazine information.
Enter Title:The times
Enter Price:120
Enter Pages:500
Magazine information :
The times 120
Pages: 500
Enter Channel information.
Enter Title:Star
Enter Price:100
Enter Frequency:250
Channel information :
Star 100
Frequency: 250
Program to illustrate Hierarchical Inheritance in Python
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer