from random import randint

aankomsttijden = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8]

def wegrijden_autos(aantal):
    totaal = 0
    for i in range(aantal):
        if len(aankomsttijden) > 0:
            totaal += aankomsttijden.pop(0)
    return totaal

# testen  
for tijd in range(1, 9):
    aantal = randint(1,3)
    totale_wachttijd = wegrijden_autos(aantal)
    print(f"{tijd=} {aantal=} {totale_wachttijd=}")
    
print(aankomsttijden)