[ad_1]
x = ['cat', 'dog', 'chicken']
y = [word[0] + '_'*(len(word)-1) for word in x]
print(y)
# ['c__', 'd__', 'c______']
[ad_2]
solved how to show only the first letter of an element of a string [closed]
[ad_1]
x = ['cat', 'dog', 'chicken']
y = [word[0] + '_'*(len(word)-1) for word in x]
print(y)
# ['c__', 'd__', 'c______']
[ad_2]
solved how to show only the first letter of an element of a string [closed]