Date Tags Python

Endless Python Tricks


These are a collection of some of the beautiful Python snippets I discovered as part of my professional work.

Trick 1

You can access/display both index and value by using enumerate() function. In the code, we are specifying two iterating variables, each_value and each_index to hold the individual items in the list and to hold the index number of each item in the list.

ET

Output

The value a is stored at the index 0
The value b is stored at the index 1
The value c is stored at the index 2
The value d is stored at the index 3
The value e is stored at the index 4


Comments

comments powered by Disqus