Python Loops Tutorial



Author: Sofiia Piustonen

Course description

Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition checking time. Today we start learning these loops. Welcome to Python Loops Tutorial!


Complete all chapters to get certificate


The for Loop


We start learning Python loops with the for loop. A for loop is used for iterating over a sequence. Let's go!

The first for Loop

Range() in a for Loop 1/2

Range() in a for Loop 2/2

List & for Loop

If/Else in a for Loop

Break/Continue in a for Loop

Pass, Else in a for Loop

Enumerate() in a for Loop


The while Loop


With the while loop, we can execute a set of statements as long as a condition is true. We are going to work with this loop and handle different problems!

The First while Loop

Infinity Loop

List & while Loop

If/Else in a while Loop

Break/Continue in a while Loop

Pass, Else in a while Loop


Nested Loops


A nested loop is a loop inside a loop. Sound difficult? Don't worry! We will handle this loop!


First Nested Loop Pattern

Nested for Loop

Nested while Loop

While Loop inside a for Loop

If/Else in a Nested Loop

Break/Continue in a Nested Loop