I'm trying to create a list of list in python:
[[0, 1, 2], [4, 5, 6], [8, 9, 10], [11, 12]]
but  my function doesn't append the last list ([11,12])
a = [a for a in list(range(13))]
print(a)
final_list = []
b =[]
for num in a:
    if len(b) <3:
        b.append(num)
    else:
        b = []
    if len(b) == 3:
        final_list.append(b)
print(final_list)
[[0, 1, 2], [4, 5, 6], [8, 9, 10]]
 
     
     
    