The simple way is to use list and get the index of selected car. Since Python starts at index zero, we need to add one(Python 3.6+ using f-format):
cars_models = ['Porsche', 'Ferrari', 'Lamborghini']
for car in cars_models:
is_wanted = input(f'Do you want a {car} / y . n: ')
if is_wanted == 'y':
car_wanted = car
selected_choice = cars_models.index(car_wanted)
print(f'Ok, you can have choice {selected_choice +1}')
We first create a list of cars we want to check. Then we loop with questions. If the answer is y, we record which car. At the end we find the location of wanted car.
Before you celebrate, we have some issues we could take care. These are what-ifs: what if the user selects all n. Our current script will crash as car_wanted will be referenced before assignment. Solutions: Ask forgiveness > permission
# ...
try:
select_choice = cars_models.index(car_wanted)
print(f'Ok, you can have choice {select_choice +1}')
except UnboundLocalError:
print('Hmm, you have no choice')
Okay, this will catch that error. We are not done. What if the use answer (N/No/no instead of n, Y/Yes/yes instead of y)? What should we do when they input something completely out of scope. E.g. 'quit'?
As a programmer you need to try see these issues and address them.