How to add these two lists index by index I mean how can I get Hello there by adding these two lists . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to add these two lists index by index I mean how can I get Hello there by adding these two lists .

x=["He","the"] y=["llo","re"]

29th Oct 2021, 2:22 PM
Vaibhav Tiwari
7 Answers
+ 7
Vaibhav Tiwari , can we see your try before we are going to help you? thanks! >>> Beauty , i suppose your code results in "Hellothere".
29th Oct 2021, 3:44 PM
Lothar
Lothar - avatar
+ 3
Vaibhav, I remember pig latin was about appending 'ay' to a given string, in some way. Why are you joining lists' elements here? I'm not getting your idea ...
30th Oct 2021, 6:23 AM
Ipang
+ 1
x=input().replace(" ",",").split(",") m=[char[0] for char in x] z=m y=[char+"ay" for char in z] n=[char.replace(char[0],"") for char in x]
30th Oct 2021, 2:49 AM
Vaibhav Tiwari
+ 1
The challenge is in code coach in community option named as "Pig Latin" challenge
30th Oct 2021, 2:49 AM
Vaibhav Tiwari
+ 1
Because the first list n=['o', 'ver, 'here'] and second list y =['gay','oay','tay']
31st Oct 2021, 2:40 AM
Vaibhav Tiwari
+ 1
If I add them both I will get the desired output I think
31st Oct 2021, 2:40 AM
Vaibhav Tiwari
0
Ok
30th Oct 2021, 2:48 AM
Vaibhav Tiwari