Python Programming · High School (11–12) · 12 courses, 122 worked problems, 240 practice questions
Python is a working tool in science and mathematics, and this area uses it to calculate, plot and model real problems. NumPy arrays handle many numbers at once. Graphs with matplotlib show patterns in data, and data analysis with pandas works with tables. Solving equations and calculus by computer turn hard mathematics into steps that a program can follow. Trigonometry and waves by computer draws and adds waves, and simulation and randomness models chance events. Chemistry by computer and biology by computer apply the same tools to moles, growth and genetics.
Choose an answer, then check it. Each one shows a full explanation.
A sprinkler arm turns through 84 degrees. What does this print? import math; print(round(math.radians(84), 3))
An angle of 2.2 radians is changed to degrees. What does this print? import math; print(round(math.degrees(2.2), 1))
Which call gives the sine of an angle of 35 degrees?
A loop prints cosines of three angles. What does this print? import math; print(*[round(math.cos(math.radians(d))) for d in (0, 90, 180)])
A program draws y = 6 * np.sin(4 * x - 1). What is the amplitude of the wave?
A list of angles in degrees. What does this print? import numpy as np; x = np.arange(0, 181, 30); print(len(x), x[-1])
Why is the tangent changed with t[np.abs(t) > 8] = np.nan before it is plotted?
A check of an identity on three angles. What does this print? import numpy as np; a = np.radians(np.array([10, 20, 30])); print(np.allclose(np.sin(a) ** 2 + np.cos(a) ** 2, 1))
Why compare np.sin(a) ** 2 + np.cos(a) ** 2 with 1 using np.allclose and not ==?
The true sine of a sum and the false rule, side by side. What does this print? import numpy as np; a, b = np.radians(25), np.radians(65); print(round(float(np.sin(a + b)), 2), round(float(np.sin(a) + np.sin(b)), 2))
All 240 practice questions on Python for Science and Maths →
Each one has a hint, the key idea and a full worked solution.