Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Pass, Else in a while Loop | The while Loop
Python Loops Tutorial
course content

Course Content

Python Loops Tutorial

Python Loops Tutorial

1. The for Loop
2. The while Loop
3. Nested Loops

bookPass, Else in a while Loop

Allow me to remind you that the pass statement is a null statement. When executed, it results in no action.

Examine the code below:

12345
counter = 0 while counter < 10: counter += 1 pass
copy

Additionally, as a reminder, in Python, a loop can include the else block, which executes when the loop terminates under normal conditions.

Examine the code below:

1234567
counter = 0 while counter < 10: print(counter) counter += 1 else: print('Done!')
copy
Task
test

Swipe to show code editor

Fill in the gaps with while, pass, and else.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
toggle bottom row

bookPass, Else in a while Loop

Allow me to remind you that the pass statement is a null statement. When executed, it results in no action.

Examine the code below:

12345
counter = 0 while counter < 10: counter += 1 pass
copy

Additionally, as a reminder, in Python, a loop can include the else block, which executes when the loop terminates under normal conditions.

Examine the code below:

1234567
counter = 0 while counter < 10: print(counter) counter += 1 else: print('Done!')
copy
Task
test

Swipe to show code editor

Fill in the gaps with while, pass, and else.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
toggle bottom row

bookPass, Else in a while Loop

Allow me to remind you that the pass statement is a null statement. When executed, it results in no action.

Examine the code below:

12345
counter = 0 while counter < 10: counter += 1 pass
copy

Additionally, as a reminder, in Python, a loop can include the else block, which executes when the loop terminates under normal conditions.

Examine the code below:

1234567
counter = 0 while counter < 10: print(counter) counter += 1 else: print('Done!')
copy
Task
test

Swipe to show code editor

Fill in the gaps with while, pass, and else.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Allow me to remind you that the pass statement is a null statement. When executed, it results in no action.

Examine the code below:

12345
counter = 0 while counter < 10: counter += 1 pass
copy

Additionally, as a reminder, in Python, a loop can include the else block, which executes when the loop terminates under normal conditions.

Examine the code below:

1234567
counter = 0 while counter < 10: print(counter) counter += 1 else: print('Done!')
copy
Task
test

Swipe to show code editor

Fill in the gaps with while, pass, and else.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 2. Chapter 6
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt