Inheritance
Three exercises on the base class Messreihe, which is already in the editor. Part 2 copies the code from part 1 with a button.
Part 1 — TemperaturVersuch inherits from Messreihe
Own attribute with super(), a new method.
Exercise
The finished base class Messreiheis already in the editor. Derive the class TemperaturVersuch from it. Its constructor additionally receives einheit="°C" and stores it in the attribute einheit; it takes over name and readings with super().__init__(name, messwerte). The method max_temp() returns the highest temperature.
Example TemperaturVersuch("Erwärmung", [20, 24, 22]).max_temp() yields 24.
Part 1 — Your Code
Loading Python…Tests
Part 2 — Own __str__ for the temperature experiment
Overriding an inherited method.
Exercise
Copy your class from part 1 and, in TemperaturVersuch , override the method __str__(), so that the experiment states maximum and unit instead of the mean.
Example print(TemperaturVersuch("Erwärmung", [20, 24, 22])) shows exactly Temperaturversuch Erwärmung: 3 Werte, Maximum 24 °C. An ordinary Messreihe still introduces itself as before.
Part 2 — Your Code
Loading Python…Tests
Part 3 — Pressure series with limits
A second subclass for the lab.
Exercise
Derive from Messreihe the class Druckmessreihe(name, messwerte, minimum, maximum) and store the limits in the attributes minimum and maximum. The method alle_plausibel() gibt True if every reading lies between the limits, limits included. ausreisser() returns the list of readings that lie outside.
Example For the values [2.0, 11.5, 2.4] with the limits 0 and 10, alle_plausibel() equals False and ausreisser() equals [11.5].
Part 3 — Your Code
Loading Python…Tests
Report as PDF
Document and download your solutions.
Module overview
| Part | Status |
|---|---|
| Part 1: Inheriting | Open |
| Part 2: Overriding | Open |
| Part 3: Pressure series | Open |
Not all parts are complete yet — the report can still be created.
Download PDF
Enter your name. The PDF contains your code, completion status, and a QR code for verification.