"" White Time: January 9, 2018 demand: Suppose you have a lot of cars, By constantly asking if you want to add a vehicle to your inventory, if you do, then it will ask for details of the car. If not, the application prints the details of all cars and exits. function: Loop to add information about the car and record information into the dictionary "" "Def main (): car_list = [] while true: add_inventory = input (' Do you want to add car info? (y/n): ') if add_inventory == ' y ': car_model = input (' Please enter the model of the car: ') car_color = input (' Please enter the color of the car: ') car_year = input (' Please enter the number of years of the car: ') car_ Miles = input (' Please enter the car's kilometer: ') car_dict={' model ': Car_ Model, ' Color ': Car_color, ' Year ': Car_year, ' Miles ': car_miles} print (car_dict) car_ List.append (car_dict) elif add_inventory == ' n ': print (car_list) breakif __name__ == ' __main__ ': main ()
Python uses lists and dictionaries to store information