bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

Python Loops

 

While Loop

In this body is executed until condition is true. Once the condition becomes false then control comes out the loop.

Syntax 

while condition:

Body of while loop

while loop

 

e.g.

i = 10

while i>5:

print i

i=i-1

Output 

10

9

8

7

6

 

For Loop

For loop executes the sequence of code according to the specified times and conditions.

Syntax

for variable in sequence:

Body of for loop

for loop

 

e.g.

i=1

for i in range(1,8):

print 2*i

Output 

2

4

6

8

10

12

14

 

Nested Loop 

Loop defined within another loop is known as nested loops.

Syntax 

for condition1:

for condition2:

Body of for loop

This blog will help you get a better understanding of Automate Your Coding with Python!

"0 Responses on Python Loops"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 06th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free Python Loops.