Tagged: while-loop

Everything tagged "while-loop", newest first.

Coding Practice ·

Python Coding Exercise #47: PIN and Number of Attempts

A beginner Python exercise on loops and counters — keep asking for a PIN until it is correct, count the attempts, and print a different message when it takes only one try.

Coding Practice ·

Python Coding Exercise #46: Repeat Password

A beginner Python exercise on loops and input — ask for a password once, then keep asking the user to repeat it until it matches, and learn which lines belong inside the loop and which outside.

Coding Practice ·

Python Coding Exercise #45: Fix the Code: Countdown

A beginner Python debugging exercise on while True and break — a countdown stops after the first number because the break condition is the wrong way round, and the fix is one symbol.

Coding Practice ·

Python Coding Exercise #44: Input Validation

A beginner Python exercise on loops and input validation — keep asking for numbers, reject negative ones, print the square root of positive ones, and stop when the user types zero.

Coding Practice ·

Python Coding Exercise #43: Shall We Continue?

A beginner Python exercise on your first while loop — repeat a message until the user types "no", and learn how while True and break work together.

All tags