Kodewick
Start learning →
Basic←→0 / 80

Restaurant waiting list

#017BasicComprehensionsStrings4 min

There's a queue outside the hot pot place, with names in the order people arrived. The screen shows numbers like "1. Ava": number, dot, space, name. Write queue_board(names) to return that list, numbered from 1. Nobody waiting means an empty list.

Examples
queue_board(["Ava", "Ben", "Cy"])→['1. Ava', '2. Ben', '3. Cy']
queue_board([])→[]
main.py
def queue_board(names):
    # your code here: a list comprehension with enumerate, turning each name into "number. name"
    return []
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.