Tagged: arithmetic

Everything tagged "arithmetic", newest first.

Coding Practice ·

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.

Coding Practice ·

Python Coding Exercise #28: Solving a Quadratic Equation

A beginner Python exercise that turns the quadratic formula into code — read a, b and c, calculate the discriminant, and use sqrt() to find the two roots, with attention to brackets and order of operations.

Coding Practice ·

Python Coding Exercise #27: Hypotenuse of a Right-Angled Triangle

A beginner Python exercise on the math module — use Pythagoras' theorem and sqrt() to find the hypotenuse of a right-angled triangle, read decimal sides with float(), and format the answer to two decimal places.

Coding Practice ·

Python Coding Exercise #22: Area and Circumference of a Circle

A beginner Python exercise on the math module — read a radius, calculate a circle's area and circumference using pi, and round the answers to two decimal places.

Coding Practice ·

Python Coding Exercise #21: Grams to Kilograms

A beginner Python exercise on unit conversion — turn a whole number of grams into kilograms and leftover grams, then polish the output so singular and plural words and zero values read correctly.

Coding Practice ·

Python Coding Exercise #18: Daily Wages

A beginner Python exercise on if statements and arithmetic — calculate a day's pay from the hourly wage and hours worked, with double pay on Sundays.

Coding Practice ·

Python Coding Exercise #17: Temperatures

A beginner Python exercise that converts Fahrenheit to Celsius and prints an extra message when the result is below zero — practice with formulas, floats and if statements.

Coding Practice ·

Python Coding Exercise #16: Calculator

A beginner Python exercise on comparing strings with if statements — build a small calculator that adds, subtracts or multiplies two numbers depending on the operation the user types.

Coding Practice ·

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.

Coding Practice ·

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.

All tags