Tagged: python
Everything tagged "python", newest first.
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 #42: Gift Tax Calculator
A beginner Python exercise on if, elif and else with several ranges — calculate gift tax from a table of brackets, and learn to turn a complicated table into a simple reference table before writing any code.
Python Coding Exercise #41: Alphabetically in the Middle
A beginner Python exercise on comparing strings and chained comparisons — find which of three letters would be in the middle in alphabetical order, and compare a chained-comparison solution with a nested if solution.
Python Coding Exercise #40: Leap Year
A beginner Python exercise on if, elif and else with the remainder operator — decide whether a year is a leap year, handle the century-year exception, and compare a flat chain of conditions with a nested if.
Python Coding Exercise #39: FizzBuzz
A beginner Python exercise on the remainder operator and the and operator — print Fizz, Buzz or FizzBuzz depending on whether a number is divisible by 3, 5 or both, and see why the order of the conditions matters.
Python Coding Exercise #38: Grades and Points
A beginner Python exercise on if, elif and else with ranges — turn a table of point boundaries into a grade, handle impossible values, and see two ways to write the conditions.
Python Coding Exercise #37: Nephews
A beginner Python exercise on the or operator — recognise a name that matches any one of several options, avoid the classic mistake of writing or "Dewey", and meet the shorter in operator.
Python Coding Exercise #36: Age Check
A beginner Python exercise on if, elif and else with three outcomes — respond to an age that is normal, too young, or impossible — and learn why the order of the conditions matters.
Python Coding Exercise #35: Alphabetically Last
A beginner Python exercise on comparing strings — find which of two words comes last in alphabetical order, and learn how Python compares text, including the effect of uppercase letters.