def chunks(lista, n):
for i in range(0, len(lista), n):
yield lista[i:i + n]
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
print(list(chunks(l, 3)))
ZGVmIGNodW5rcyhsaXN0YSwgbik6CiAgICBmb3IgaSBpbiByYW5nZSgwLCBsZW4obGlzdGEpLCBuKToKICAgICAgICB5aWVsZCBsaXN0YVtpOmkgKyBuXQoKbCA9IFswLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5LCAxMCwgMTEsIDEyLCAxMywgMTRdICAgICAgICAKcHJpbnQobGlzdChjaHVua3MobCwgMykpKQ==
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]