We run the "Word mix" code , The output will be like this
The nth word in the output should contain nth letter of each word in the given sentence. The letters of the output word should be in same order as the words in the given sentence. If a word in the given sentence doesn't have n-letters, you can skip it while considering the letters of the n-th word.
Ex: Input :: Welcome to your first problem
Output :: Wtyfp eooir luro crsb otl me em
But,run the above code displayed only "Wtyfp" .
s = input().split()
l = list()
for word in s:
for i in range(len(word)):
if (len(l) > i):
l[i] += word[i]
else:
l.append(word[i])
for i in l:
print(i, end=' ')
Comments
Leave a comment