A427 of 56
0 XP
  1. Hook
  2. Problems

A4 · Midterm exam

Midterm exam: Python fundamentals

Five labs covering lessons 1 to 25. Give yourself two hours and work without the lessons open. Each lab is graded by hidden tests; read their messages if a check fails, fix, and check again. "Another set" deals a different exam.

Check

Write divider(Vs, R1, R2) returning a tuple (Vout, I, P): the output voltage, the current through the chain and the total power. Set Vout, I, P = divider(Vs, R1, R2).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write eng(x) formatting a positive number with an SI prefix and three significant figures (p, n, u, m, none, k, M), like eng(0.0047) → "4.7m". Set out to the list of eng applied to the starter's values.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Use Newton's update x←x−(x3−a)/(3x2) from x=a until |x3−a|<10−12a, and set x to the cube root of a = 3 and steps to the number of updates.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Set by_node to a dictionary from each node to the sorted list of part names connected to it.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write a class Res with value and tol (a fraction), a method bounds(), and a function series_bounds(parts) returning the lowest and highest total of a list of Res in series. Set lo, hi = series_bounds([Res(1000, t / 100), Res(2200, t / 100), Res(470, t / 100)]).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Have paper and a calculator ready. Work each problem out by hand, then enter the answer. Your first try on each one counts toward your score.

Practice

Keep practicing

8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.