Answers for "how to do steps in python for loops"

3

how to use for loops python

#simple for loop to print numbers 1-99 inclusive
for i in range(1,100):
  print(i)
  
#simple for loop to loop through a list
fruits = ["apple","peach","banana"]
for fruit in fruits:
  print(fruit)
Posted by: Guest on October-25-2020
0

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
Posted by: Guest on August-29-2021

Code answers related to "how to do steps in python for loops"

Python Answers by Framework

Browse Popular Code Answers by Language