Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to enumerate the names inside a list python

names = ["David", "Sarah", "Matt"]

# i is used for the numbers and name for the names
for i, name in enumerate(names):
# i + 1 so the enumeration starts from one not zero
    print(i + 1 , name)

#output:
# 1 David
# 2 Sarah
# 3 Matt
Comment

PREVIOUS NEXT
Code Example
Python :: how to change graph after every second in python 
Python :: How to Use the abs() Function with an Integer Argument 
Python :: how to read file from terminal in python inside code 
Python :: Pandas: Ternary conditional operator for setting a value in a DataFrame 
Python :: scale just one column pandas 
Python :: pandas python multiindex 
Python :: hoow to print python 
Python :: huffepuf 
Python :: write yaml file without deleting content 
Python :: trends in yearly data python 
Python :: python or in if statement 
Python :: give utton a number python 
Python :: iptc text classification example 
Python :: uppy tus 
Python :: if condition in djangio template 
Python :: python pyinstler not found 
Python :: networkx - calculate degree per each node 
Python :: How to create an AI from scratch 
Python :: pyqt5 update display 
Python :: newspaper pypi 
Python :: new column in pandas with where logic 
Python :: reference other libraries in library 
Python :: tkinter e.delete(0,END) 
Python :: how to flatten the image dataset 
Python :: write python command to display your name 
Python :: how to respond to a number in python 
Python :: extract all namespace from xml file python 
Python :: python list comprehension with filter example 
Python :: how to delete a cell in jupyter notebook 
Python :: kloppy, public datasets, Standardized models, football tracking, data science 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =