+ 2

How do I add a name to all the elements of a list?

Example: Words=[ā€œhiā€, ā€œmeā€, ...] Words_1=[ā€œuphiā€ , ā€œupmeā€..]

17th May 2018, 4:09 PM
Andrea Bracci
Andrea Bracci - avatar
3 Answers
+ 5
Or: words=["hi", "me", "you"] words = list(map(lambda word: word + "up", words)) print(words)
17th May 2018, 4:37 PM
Paul
Paul - avatar
+ 2
[s + mystring for s in mylist]
17th May 2018, 4:15 PM
Rajeeb
0
Thaks a lot!
17th May 2018, 4:51 PM
Andrea Bracci
Andrea Bracci - avatar