For loop in python with program example

 For loop in python with program example


#this program prints values from list but mark x>=6 as valid and other elements invalid

#this program prints values from list but mark x>=6 as valid and other elements invalid
list1=["hum",0,"tum",99,"woh",54,"sab",6,"har",5,"koi"]
for x in list1: #for loop
if str(x).isnumeric() and x>=6: #prints value of x if >=6
print("valid ",x)
else:
print("not valid ",x)
range() function in for loop example
for a in range(5,20,3): # 5 is starting index, 20 is ending index , 3 is increment 
print(a)

Comments