Tagged: loops
Everything tagged "loops", newest first.
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.
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.
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.
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.
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.
Python Coding Exercise #02: Sorting Names
A beginner Python exercise on lists, the sort() method, and for loops — fix a program so the names of the seven brothers from "Seitsemän veljestä" print in alphabetical order.