Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

enumerate python

languages = ["Python", "C", "C++", "C#", "Java"]
counter = 1

for item in languages:
    print(counter, item)
    counter += 1

for item in enumerate(languages):
    print(item[0], item[1])

for num,lang in enumerate(languages):
    print(num,lang)
    
[print(num,lang) for num,lang, in enumerate(languages)]
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #enumerate #python
ADD COMMENT
Topic
Name
8+2 =