Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make a for loop increment by 2 in python

for i in range(0, 11, 2): #range follows (start, stop, step)
  print(i)
# 0 2 4 6 8 10
Comment

python loop increment by 2

n = 2 #set variable to complete the output
for i in range(2, 20 +n, n): #range("begin" , "end" , "increment by")
  print(i, end = " ") #print horizontally
Comment

PREVIOUS NEXT
Code Example
Python :: how to run django tests 
Python :: how to give column names in pandas when creating dataframe 
Python :: flask server not reloading 
Python :: login_required 
Python :: tkinter radio buttons 
Python :: python float precision 
Python :: python ascii caesar cipher 
Python :: password text in entry in tkinter 
Python :: phone number regex python 
Python :: select only some rows pandas 
Python :: with urllib.request.urlopen("https:// 
Python :: Efficiently count zero elements in numpy array? 
Python :: convex hull algorithm python 
Python :: take array of string in python 
Python :: merge and join dataframes with pandas in python 
Python :: how to import flask restful using pip 
Python :: how to create a countdown timer using python 
Python :: add a string to each element of a list python 
Python :: ascii to decimal python 
Python :: python datetime get all days between two dates 
Python :: python sqlite insert 
Python :: python hello world program 
Python :: numpy drop duplicates 
Python :: count rows with nan pandas 
Python :: creating venv on vscode linux 
Python :: make binary tree in python 
Python :: python detect lines 
Python :: mongodb aggregate count 
Python :: combine two dictionary adding values for common keys 
Python :: how to download the captions of a youtube video 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =