Untitled

 avatar
unknown
plain_text
2 years ago
535 B
4
Indexable
# Find the length of the input list
    n = len(input_list)
    # Find the length of each sublist
    m = len(input_list[0])
    # Initialize the output list with empty sublists
    output_list = [[] for _ in range(m)]
    # Loop through each sublist in the input list
    for i in range(n):
        # Loop through each element in the sublist
        for j in range(m):
            # Append the element to the appropriate sublist in the output list
            output_list[j].append(input_list[i][j])
    return output_list
Editor is loading...