Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lista = [[2, 6], [1, 3, 4], [2], [2], [7], [1], [6]]
- lista_bool = [False for x in lista]
- kolejka = []
- for element in lista[0]:
- kolejka.append(element)
- lista_bool[0] = True
- while len(kolejka) > 0:
- value = kolejka.pop(0)
- if not lista_bool[value - 1]:
- lista_bool[value-1] = True
- for index in lista[value-1]:
- kolejka.append(index)
- print(lista_bool)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement