A4 Python for engineers · Practice
Values, variables and functions,
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
Write a function power(V, R) that returns the power, in watts, that a resistor dissipates with voltage across it.
This lab's V = 10 V and R = 15 Ω are already defined, in volts and ohms.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write parallel(R1, R2) that returns the resistance of two resistors in parallel, .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write divider(Vs, R1, R2) returning a divider's output voltage, then print it for this lab's values with three significant figures, like Vout = 3.84 V.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A wire's resistance is , with the area of its cross-section. Write wire_resistance(rho, L, d) with everything in SI units (meters). Then set R for copper ( Ω·m) of length L = 2 m and diameter d = 0.5 mm.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write current(V, R) returning the current through a resistor.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write tau(R, C), the time constant in seconds, and print it in milliseconds with three significant figures.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write db(r) that returns a power ratio in decibels.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write energy_wh(Q, V): a battery's energy in watt-hours from its capacity Q in mAh and its voltage V.
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