sytem slowed while flattening

PHOTO EMBED

Wed Jun 01 2022 15:01:55 GMT+0000 (UTC)

Saved by @redpsych #undefined

# system slowed
list_ = [0, [2, 3, [5, 4], 6, 5], [3, 4, 5], 6, 7, 9]
list1 = []
for item in list_:
    if type(item)== list:
        while type(item)== list:
            list1.extend(item)
    else:
        list1.append(item)
#         if type(item)== list:
#             list1.extend(item)
#         elif type(item)!= list:
print(list1)
    
content_copyCOPY