Issue
Is it possible to print my outputs of a for loop in one line and ordered by index: For example: outputs:TAWSG, HUHWO, ETOHO, RHDAD, EOETI, IRCID, SIISE, NTDAA, OYE ----> THEREISNOAUTHORITYWHODECIDESWHATISAGOODIDEA
Solution
lst = ['TAWSG', 'HUHWO', 'ETOHO', 'RHDAD', 'EOETI', 'IRCID', 'SIISE', 'NTDAA', 'OYE']
max_len = max([len(x) for x in lst ])
for i in range(max_len):
for x in lst:
if len(x) > i:
print(x[i], end = '')
print('\n')
Output:
THEREISNOAUTHORITYWHODECIDESWHATISAGOODIDEA
Answered By - Mahdee Mushfique Kamal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.