+ 2
Why character 'd' does not get joined to last element of the list in the below code..?
l = ['a', 'b', 'c'] print ('d'.join(l)) Output : adbdc https://code.sololearn.com/co2m89hO5CKB/?ref=app
5 Réponses
+ 4
Yathindra S. Join() is used to join the elements in a list.
Since u tried joining d , it joined the elemnts of the list by being in between them.
Check this thread 👇
https://www.sololearn.com/Discuss/1744468/?ref=app
+ 1
That's just how join works. You can append 'd' at the end with + 'd' if you need
+ 1
Hello Benjamin,
I'm still confused
If 'd' is getting joined with first two elements of list... why that doesn't get joined to last element..?
0
The joins are only between the elements
Read your example as "join elements of list l using 'd'