[Solved] Python. Issue with my interactive story [closed]


from collections import OrderedDict

cars = OrderedDict([(1, 'Camaro'), (2, 'SS Sedan'), (3, 'M3 Sedan'), (4, 'GLE Coupé')])

print('Help Rick P. choose a car to drive.\n')
print('\n'.join([str(key) + ' ' + val for key, val in cars.items()]) + '\n')

def choice_car(invalid = False):
    if invalid:
        choice = int(input('Invalid car. Try again...\n'))
    else:
        choice = int(input('Input the corresponding number to the car that you\'d like Rick P. to drive...\n'))
    car = cars.get(choice)
    if not car:
        return choice_car(True)
    return car

car = choice_car()

print(car)

0

solved Python. Issue with my interactive story [closed]