Interactive, runnable Python. Edit the code, run it in your browser, no setup required.
You will build logic gates from one gate, the NAND gate, as a factory would. The idea. A NAND gate gives 0 only when both inputs are 1. NOT is a NAND gate with its two inputs tied. AND is a NAND gate followed by a NOT…
You will write a checker for chemical equations. It adds up each atom and the charge on both sides, and it tells you which items do not balance. The idea. Each species is a dictionary of atoms, with the key "charge" f…
You will write four functions that judge a straight-line fit: the residuals, the sum of the squared residuals, the coefficient of determination and a test for a point that changes r a lot. The helper fit is already wr…
A student counts the cells of a root tip and writes the number in each stage in a dictionary. You will find the mitotic index, the minutes that a cell spends in a stage, and the stage that takes the longest. The idea.…
You will fit a sine to 60 noisy readings of a swinging spring, with a first guess from the FFT. The idea. The FFT finds the main frequency to within one bar. curve_fit then refines the amplitude, the frequency and the…
You will build a function that summarises any list of numbers: how many, the mean, the median, the range and a chance. Then it summarises the month, and the definition of a hot day is yours to choose. The idea. A summ…
You will write four functions that a designer uses for a transistor in the common-emitter circuit. The idea. β = (α)/(1 - α). In a circuit with one supply, I_B = V_CC - 0.7R_B, I_C = β I_B and V_CE = V_CC - I_C R_C, a…
You will finish a program that finds the shape of a molecule or ion from the valence electrons of the central atom, the atoms bonded to it and the charge. The idea. The central atom gives one electron to each hydrogen…
You will write four functions: the correlation coefficient, the slope and the intercept of the line of y on x, and a prediction. The checker tests them on data with known answers, and on data that lie exactly on a lin…
A cell is a dictionary with four numbers. The size is compared with the size needed. The damage is the number of unrepaired breaks in the DNA. The copied number is the share of the DNA copied at G2. The attached numbe…
You will draw a wave of wavelength 3.0 m and frequency 4.0 Hz at two times, find its first crest each time, and work out its speed. The idea. The crest of y = A(kx - ω t) moves at the speed v = fλ. You find where the…
The month of 30 days is in two lists: the temperatures and the rainy days. You will split the temperatures into rainy and dry days, and count how many days had each temperature. Then the program draws a line graph wit…
You will write four functions that describe a Zener regulator and its limits. The idea. The series resistor carries I_s = V_in - V_zR_s. The load takes (V_z)/(R_L) and the Zener diode takes the rest. The limits on R_s…
You will write a small program that finds the lone pairs, the steric number and the shape of an interhalogen or xenon compound. The idea. The central atom has some outer electrons. Each bonded atom uses one of them. T…
You will write four functions that find the quartiles, the interquartile range, the outliers and the ends of the whiskers of a box plot. The helper median_of is already written. The checker uses data with an even and…
A cell has a few pairs of homologues. Each gamete gets one chromosome from every pair. You will list all the gametes, and then count the kinds of gamete and of zygote. The idea. With n pairs, each with 2 choices, ther…
You will write three small functions that check a claimed identity on many angles: one finds the worst miss between the two sides, one says whether the identity holds, and one finds an angle where it fails. The idea.…
You will find the exact probability of each sum of two dice by listing the 36 pairs, then roll two dice 3,600 times and compare. The program draws both side by side. The idea. The exact probability counts equally like…
You will write four functions that a power-supply designer uses for a rectifier and its smoothing capacitor. The idea. For an ideal half-wave rectifier the mean output is V_m/π. For a full-wave rectifier it is 2V_m/π.…
You will finish a program that predicts which halogens oxidise which halide ions. It works from the standard electrode potentials. The idea. A halogen oxidises the halide of another halogen if its potential is higher.…
You will write four functions: the coefficient of variation, the new mean and spread after every value is changed, and the combined mean and standard deviation of two groups. The checker tests them on data with known…
A cell with two pairs of chromosomes is a list. Each chromosome is a tuple of three things: its pair ("1" or "2"), its parent ("m" for the mother or "p" for the father), and the number of chromatids it has. You will w…
You will write three small functions for angles: one that converts degrees to radians without math.radians, one that finds the quadrant of an angle, and one that returns the point of the unit circle at an angle. The i…
You will toss a coin 500 times in a program, keep the share of heads after every toss, and draw how that share moves. Then you see how close the last share comes to 0.5. The idea. The share of heads jumps about in a s…
You will write four functions that describe a silicon diode, from the diode equation to a diode in series with a resistor. The idea. The diode equation is I = I_s(e^V/V_T - 1), with V_T = (kT)/(e). In a circuit, a con…