Aan de slagGa gratis aan de slag

Public vs. private attributes

Excellent! Your coworker has decided to use object-oriented programming for the banking app they are working on. Now they need your help with implementing one of their classes, which is going to require both public and private attributes.

Deze oefening maakt deel uit van de cursus

Programming Paradigm Concepts

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Define the Car class
class Car():
    def __init__(self, price):
        # price is a public attribute
        self.____ = price
Code bewerken en uitvoeren