Coding Practice

Sharing the programming exercises I practice while learning to code.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

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.

Beginner · Python ·

Python Coding Exercise #34: The Elder

A beginner Python exercise on if, elif and else — read the names and ages of two people, print the name of the elder, and avoid the mistakes of comparing the wrong variables or comparing ages as text.

Beginner · Python ·

Python Coding Exercise #33: Greater Than or Equal To

A beginner Python exercise on if, elif and else — compare two numbers, print the greater one, and handle the case where they are equal.