A4 Python for engineers · Practice
Modules and the standard library
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
Using math.log10, write db(power_ratio) returning of a power ratio. Set g = db(ratio) for ratio = 10.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
With cmath, set Z to the impedance of R = 1000 Ω in series with C = 10 nF at f = 10000 Hz, then mag = abs(Z) and deg to its angle in degrees.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Seed the generator with random.seed(s) (s = 7) and set draws to a list of n = 5 values from random.uniform(0.95, 1.05), then m to their mean using statistics.mean.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Set med, sd and rng to the median, sample standard deviation and range (max minus min) of the starter's readings, using statistics.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Using itertools.combinations on the E12 values from 1 kΩ to 8.2 kΩ in the starter, set pair to the two different values whose series sum is closest to target = 5500 Ω (as a sorted tuple), and err to how far that sum is from the target.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Set r = cmath.sqrt(a) for a = −9, and im to its imaginary part.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Set d = math.hypot(x, y) and ang to math.degrees(math.atan2(y, x)).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in A4