Created
July 28, 2020 13:14
-
-
Save FerdinaKusumah/2d79e0343357f640fd585a7e2e924d72 to your computer and use it in GitHub Desktop.
[Python] Transpose List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Transpose 2D List""" | |
arr = [["a", "b"], ["b", "c"], ["d", "e"]] | |
transpose = list(zip(*arr)) | |
print(f'Transpose list from {arr} to {transpose}') | |
# Transpose list from [['a', 'b'], ['b', 'c'], ['d', 'e']] to [('a', 'b', 'd'), ('b', 'c', 'e')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment