0
How to add prefix in a list of string using list comprehension??
2 Answers
+ 6
word = ["gain","build","pare","exam"]
new_word = ["re-"+i for i in word]
print(new_word )
+ 2
w1 = ["java","car","ham","foo","spam"]
w2 = ["script","pet","burger","bar","egg"]
w = [p+w2[i] for i, p in enumerate(w1)]
print(w)