79448752

Date: 2025-02-18 15:22:57
Score: 0.5
Natty:
Report link

It doesn't matter what the dimensions are. Simply do a recursive flattening should work:

def flatten(lst):
    flat_list = []
    for item in lst:
        if isinstance(item, list):
            flat_list.extend(flatten(item))
        else:
            flat_list.append(item)
    return flat_list
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: PkDrew