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
CodePudding user response:
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