LoslegenKostenlos loslegen

Build a class with inheritance

You're now working with some data from a nursery on plant sales and you're building out an object-oriented program to help you handle the different types of plants that are for sale. You've already built out a Tree class, but in the process realized that you should probably make use of class inheritance and a parent Plant class. In the following exercise, you will need to build out the parent Plant class and rewrite the Tree class to inherit from it.

Diese Übung ist Teil des Kurses

Programming Paradigm Concepts

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Define the Plant class
class ____():
    def __init__(____, price):
        self.price = ____
Code bearbeiten und ausführen