Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python for loop with step

for i in xrange(0,10,2):
  print(i)
Comment

steps in for loop python

list_1 = [9, 5, 7, 2, 5, 3, 8, 14, 6, 11]

for i in range(0, len(list_1), 2) :
    print(list_1[i])
    
2 is the steps
output:
9
7
5
8
6
Comment

PREVIOUS NEXT
Code Example
Python :: how to add values to a list in python 
Python :: pytorch older versions 
Python :: how to make a dict from a file py 
Python :: beautifulsoup check if text exists 
Python :: gurobi python example 
Python :: ast python 
Python :: pandas series plot horizontal bar 
Python :: counter +1 python 
Python :: how to find the path of a python module 
Python :: IndentationError: unexpected indent 
Python :: sentence similarity python 
Python :: django queryset to list 
Python :: how to see the whole dataset in jupyterlab 
Python :: wikipedia python module 
Python :: remove column by index 
Python :: dense layer keras 
Python :: python png library 
Python :: geopandas geometry length 
Python :: Invalid comparison between dtype=datetime64[ns] and date filter 
Python :: pyqt5 qtextedit change color of a specific line 
Python :: lambda function in python 
Python :: pandas filter rows by value 
Python :: python delete first two indexes 
Python :: line plot python only years datetime index 
Python :: numpy array serialize to string 
Python :: write in entry() in tkinter 
Python :: read image file python 
Python :: animations on canvas tkinter 
Python :: optimizationed bubble sort optimizationed 
Python :: Creating and writing to a new file 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =