DEV Community

Francisco Maria Calisto
Francisco Maria Calisto

Posted on

Answer: How to make list of cars into string?

You can try the following:

def car_list_as_string(cars: list) -> str
    """
    Create a list of cars.
    The order of the elements in the string is the same as in the list.

    [['Audi', ['A4']], ['Skoda', ['Superb']]] =>
    "Audi A4,Skoda Superb"
    """
    car_strings = []
    for car in cars:
        brand = car[0]

Top comments (0)