# For Loop statement

Executes a sequence(list ,triple or string) of statements multiple time .

## Example For loop statement

#first example Food = ['Vegetables ', 'Fruit', 'Lean meats'] for Food in Foods: # Second Example print 'Current food :', food print "Good meal!"

**Result**

Current food:Vegetables Current food:Fruit Current food:Lean meats Good meal!

## Range() functions

### Example

for x in range(3): print(x)

**Note:**0 to 3 is not visible but 0 to 2 is visible .

## Else statement with loop

lower = 20 upper = 50 # uncomment the following lines to take input from the user #lower = int(input("Enter lower range: ")) #upper = int(input("Enter upper range: ")) print("Prime numbers between",lower,"and",upper,"are:") for num in range(lower,upper + 1): for i in range(2,num): if (num % i) == 0: break else: print '%d is a prime number \n' %(num),

**Result:**

Executing the program.... $python2.7 main.py ('Prime numbers between', 20, 'and', 50, 'are:') 21 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 23 is a prime number 25 is a prime number 25 is a prime number 25 is a prime number 27 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 29 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 31 is a prime number 33 is a prime number 35 is a prime number 35 is a prime number 35 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 37 is a prime number 39 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 41 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 43 is a prime number 45 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 47 is a prime number 49 is a prime number 49 is a prime number 49 is a prime number 49 is a prime number 49 is a prime number