Tagged: math-module
Everything tagged "math-module", newest first.
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.
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.
Python Coding Exercise #25: Greatest Common Divisor
A beginner Python exercise on the math module — find the greatest common divisor of two numbers with math.gcd(), and understand what a GCD is and how Euclid's method finds it.
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.