In Python, given the following array of strings,
[ 'abc',
'def',
'ghi',
'jkl'
]
how do you transform it so it becomes,
[ 'jgda',
'kheb',
'lifc'
]
Using zip and str.join
Ex:
a = ['abc', 'def', 'ghi', 'jkl']
for i in zip(*a):
print("".join(i)[::-1])
Output:
jgda
kheb
lifc
[::-1] to reverse the string.list(map(''.join, zip(*reversed(lst))))for i in zip(*a[::-1]): print("".join(i))