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…
You will write a formal charge function, add up the sizes of the charges, and use them to choose the best Lewis structure of the phosphate ion. The idea. Formal charge = V - L - B. The best structure has the smallest…
You will find how many terms an arithmetic progression needs to reach a target, and recover the terms from a formula for the sum. Your tasks. In terms_to_reach, return the smallest n for which the sum of the first n t…
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…
You will write two functions that add bond dipoles, then use the idea of full charges to find how ionic a bond is. The idea. Two equal bond dipoles at an angle θ add to 2μ_b(θ)/(2). In a flat molecule, each bond dipol…
You will write the terms of an arithmetic progression and its sum by the formula, then check that the two agree. Your tasks. In ap_terms, return the list of the first n terms. In ap_sum, return the sum of the first n…
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…
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…
You will write the formula for the nth term, a function that finds which term a number is, and use them to count. The idea. a_n = a + (n - 1)d. To find which term a number v is, n = (v - a)/(d) + 1, and it must be a w…
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…
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…
You will write a function for the differences of a list, use it to test for an AP, and sort some lists. The idea. A list is an AP when all the differences between neighbouring terms are equal. A list of one or two num…
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…