LU12.L01 - Auto

car.py
from dataclasses import dataclass
 
 
@dataclass
class Car:
    """
    a car
    """
    brand: str
    model: str
    construction: int
 
 
if __name__ == '__main__':
    pass
main.py
from car import Car
 
 
def main():
    car_list = []
    while True:
        brand = input('Marke > ')
        if brand != '':
            model = input('Modell > ')
            construction = input('Baujahr > ')
            car = Car(brand=brand, model=model, construction=construction)
            car_list.append(car)
        else:
            break
 
    for car in car_list:
        print(car.construction)
        print(car.brand)
        print(car.model)
 
 
if __name__ == '__main__':
    main()

Marcel Suter