LU12.L01 - Auto

from car import Car
 
 
def main():
    car_list = []
    while True:
        brand = input('Marke > ')
        if brand != '':
            car = Car()
            car_list.append(car)
            car.brand = brand
            model = input('Modell > ')
            car.model = model
            construction = input('Baujahr > ')
            car.construction = construction
        else:
            break
 
    for car in car_list:
        print(car.construction)
        print(car.brand)
        print(car.model)
 
if __name__ == '__main__':
    main()
from dataclasses import dataclass
 
 
@dataclass
class Car:
    """
    a car
    """
    brand: str
    model: str
    construction: int
 
 
if __name__ == '__main__':
    pass
  • modul/archiv/m319python/learningunits/lu12/loesungen/auto.txt
  • Zuletzt geändert: 2024/03/28 14:07
  • von 127.0.0.1