I have a list:
lst = ['cat', 'cow', 'dog']
Need to print:
A1 cat
B2 cow
C3 dog
How I can do it?
Here is one way.
from string import ascii_uppercase
lst = ['cat', 'cow', 'dog']
for num, (letter, item) in enumerate(zip(ascii_uppercase, lst), 1):
print('{0}{1} {2}'.format(letter, num, item))
# A1 cat
# B2 cow
# C3 dog
Explanation
enumerate
for a numeric counter with optional start value of 1.string.ascii_uppercase
to loop upper case alphabet.zip
and loop through, using str.format
to format your output.