A4 Python for engineers · Practice
Repeating with for and while
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
A ladder has n = 15 resistors in series: the first is R0 = 100 Ω and each one after is d = 10 Ω bigger. Set total to their sum, using a for loop.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Using a while loop, set n to the smallest whole number with M = 1000.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Find for a = 10 by repeating from until . Set x to the result and steps to how many updates it took.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A capacitor charges as after k steps of . Set k to the first step at which it exceeds f = 0.95.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
An RC low-pass driven by a 1 V step obeys when stepped forward by Euler's method, with . Starting from , run n = 50 steps with r = 0.1 in a for loop. Set v to the final value and err to how far it is from the exact .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Set f to for n = 8, with a for loop.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Set count to how many whole numbers from lo = 10 to hi = 100 inclusive are multiples of m = 7.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A battery keeps of its charge each month (r = 0.02). Set months to the first whole month when it's at or below target = 0.5 of full.
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