Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
535 B
1
Indexable
Never
# 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