004_oop
class Audi(Car): | |
def __init__(self, year, line, is_sline): | |
self.year = year | |
self.line = line | |
self.is_sline = is_sline | |
def describe(self): | |
return f'Describe method of the Audi class' | |
def __str__(self): | |
if self.is_sline: | |
return f'S Line Audi {self.line} from {self.year}' | |
else: | |
return f'Audi {self.line} from {self.year}' | |
a3 = Audi(year=2012, line='A3', is_sline=False) | |
a4 = Audi(year=2015, line='A4', is_sline=True) | |
print(a3) | |
print(a4) | |
print(a3.describe()) | |
print(a4.stop()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment