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