Question: ( a ) Explain what inheritance is in the context of Python; make sure to also explain the meaning of the concepts parent class and

(a) Explain what inheritance is in the context of Python; make sure to also explain the meaning of the concepts parent class and child class. [5 marks](b) Implement a class ProbDistribution for probability distributions together with derived classes for (i) normal distributions (with the parameters and for the mean and variance respectively),(ii) binomial distribution with the parameters n and p. The instances of the classes should have the following attributes: (i) mean, the mean of the distribution, (ii) variance, the variance of the distribution, (iii) sample, a function that gives a random sample from the distribution, as well as a method __add__ for adding two instances (which are assumed to be independent).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!