Classes
5 / 17
EasyOutput prediction

__init__ with a default parameter

What does this code print?

class Car:
    def __init__(self, make, year=2020):
        self.make = make
        self.year = year

a = Car('Toyota')
b = Car('Honda', 2023)
print(a.year, b.year)

← → arrow keys to navigate

Sign in to save your progress.