Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list(my_enumerate(your_sequence)) == list(enumerate(your_sequence))

my_list = ['apple', 'banana', 'grapes', 'pear']
counter_list = list(enumerate(my_list, 1))
print(counter_list)
# Output: [(1, 'apple'), (2, 'banana'), (3, 'grapes'), (4, 'pear')]
Source by book.pythontips.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
8+7 =