Coding Practice

Sharing the programming exercises I practice while learning to code.

Beginner · Python ·

Python Coding Exercise #12: Students in Groups

A beginner Python exercise on integer division, the remainder operator and if/else — work out how many groups a class needs when the students don't divide evenly.

Beginner · Python ·

Python Coding Exercise #11: Food Expenditure

A beginner Python exercise that combines int(), float(), arithmetic and a multi-line f-string — estimate a user's weekly and daily food expenditure from three inputs.

Beginner · Python ·

Python Coding Exercise #10: Fix the Code (Product)

A beginner Python debugging exercise — why a program that asks for three numbers prints 125 instead of 30, and how using separate variables fixes it.

Beginner · Python ·

Python Coding Exercise #09: Calculations with Input

Three short beginner Python exercises that read numbers with input() and calculate with them — seconds in a number of days, the sum and product of two numbers, and the sum and mean of four numbers.

Beginner · Python ·

Python Coding Exercise #08: Converting Input to Integer

Two beginner Python exercises that turn input() into an integer with int() so it can be used in a calculation — multiplying a number by five, and working out someone's age from their birth year.

Beginner · Python ·

Python Coding Exercise #07: Print a Single Line

A beginner Python exercise on the end argument of print() — how to make several print commands write their output on one line instead of one line each.

Beginner · Python ·

Python Coding Exercise #06: Arithmetics

A beginner Python exercise on arithmetic operators and f-strings — print the sum, difference, product and quotient of two variables so the program still works when the values change.

Beginner · Python ·

Python Coding Exercise #05: Extra Space

A beginner Python exercise on print() and whitespace — why commas in print() add extra spaces, and how f-strings give you exact control over the output.

Beginner · Python ·

Python Coding Exercise #04: User Input and f-Strings

Five beginner Python exercises that combine input() with f-strings — printing a name twice, adding exclamation marks, formatting an address, fixing an f-string program, and filling in a story.

Beginner · Python ·

Python Coding Exercise #03: Printing Output

Two beginner Python exercises on print() — calculating the minutes in a year inside a print statement, and printing a line of code that itself contains quotation marks.