Interactive, runnable Python. Edit the code, run it in your browser, no setup required.
0.80 kg of water at 85 ^ is mixed with different amounts of water at 12 ^, from 0.2 kg to 3.0 kg. You will make the program find the final temperature and the total change of entropy for each amount, and how much cold…
The boiling points of the hydrides of groups 15, 16 and 17 are stored in three lists, from period 2 to period 5. In each group, the hydride of period 2 can form hydrogen bonds. You will find how far it stands above th…
Write a quadratic solver that never gives up, and a function for square roots of complex numbers. Use math.sqrt only, so you see where the i comes from. The idea. When D < 0, the roots are -b ± i√(-D)2a. In Python, co…
A health worker has counted the girls and boys under six in five villages. You will write a function for the sex ratio, find it for every village, list the villages below 950, and find the ratio of the whole district.…
You will find, with pandas alone, the elements of periods 2 and 3 whose first ionisation enthalpy falls below the element before, and the mean of each block. The idea. df.groupby("period")["ie"].diff() gives the chang…
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…
An engine's hot reservoir is at 680 K. You will make the program draw the best possible efficiency for cold reservoirs from 250 K to 600 K, and compare a real engine with that limit. The real engine takes in 2300 J an…
The molecular orbitals of a diatomic molecule are stored in a list, from the lowest energy up, with how many electrons each holds and whether it is bonding. You will write a function that fills them with a given numbe…
Python can do complex arithmetic for you. Here you write it yourself, with each number kept as two real numbers: a + ib is the pair (a, b). The idea. (a + ib)/(c + id) = ((a + ib)(c - id))/(c^2 + d^2). Expand the top…
Neha keeps a simple calendar of her cycle, counting days from the start of the year. You will write a function for the start of the next period, list her next six periods, and add up the days of bleeding. The idea. A…
You will ask the table of the first 20 elements three questions: which elements are alkali metals, how period 3 lines up by size, and what each ionisation enthalpy is in electron volts. The idea. A filter is df[condit…
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…
A monatomic gas goes clockwise round a rectangle: up at 1.2 L from 1.2 × 10^5 Pa to 3.5 × 10^5 Pa, out to 3.2 L, down, and back. You will make the program find the net work, the heat taken in, and the efficiency of an…
Six molecules are stored with the outer electrons of their central atom and the number of singly bonded atoms. You will find the electron pairs on each central atom, its hybridisation, and the molecules that keep a lo…
You will write a function for any power of i, positive or negative, and a function that divides one complex number by another by the rule. The checker tests them against Python. The idea. i^n depends only on the remai…
Three crop plants are counted in a school garden: how many flowers each has, how many ovules each ovary holds, and what share of the ovules is fertilised. You will find the seeds of each plant, the plant with the most…
Ammonia burns in oxygen in the first step of making nitric acid: 4NH_3 + 5O_2 → 4NO + 6H_2O. You will write a function that takes the moles of the reactants and returns the limiting reagent, the moles of each product…
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…
Air in a pump is squeezed quickly, and its pressure is read at six volumes. You will make the program find γ from the readings, using a straight-line fit, and predict the pressure at 1.0 L. The idea. For an adiabatic…
A dictionary links each pair of numbers, electron pairs and lone pairs, to the name of a shape. You will count the pairs on the central atom of sulphur tetrafluoride, find its lone pairs, and look up its shape. The id…
You will add and multiply complex numbers by the rules alone, each number given by its two real parts. Then the checker compares your answers with Python's own complex numbers. The idea. (a + ib) + (c + id) = (a + c)…
A single cell is put in fresh food. It divides by binary fission every 30 minutes, and every daughter cell does the same. You will list the number of cells after each hour, find when the culture first has more than 50…
You will write the reader at the heart of a molar mass calculator. It turns a formula string into a dictionary of symbols and counts, then a second function opens one bracket. The idea. re.findall(r"([A-Z][a-z]?)(\d*)…
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…
A gas at 2.2 × 10^5 Pa expands from 1.5 L to 6.0 L, once at a steady temperature and once adiabatically (γ = 1.40). You will make the program draw both curves and find the work of each from the area under it. The idea…