How to enumerate a sequence of strings start with 1 in Python

1 Answer

0 votes
sq = ['c', 'c++', 'python', 'java']
lst = list(enumerate(sq, start=1))
print(lst)


'''
run:

[(1, 'c'), (2, 'c++'), (3, 'python'), (4, 'java')]

'''

 



answered Jul 1, 2018 by avibootz

Related questions

1 answer 189 views
1 answer 175 views
3 answers 212 views
1 answer 180 views
...