Python Programming · High School (11–12) · 2 courses, 20 worked problems, 40 practice questions
Chemistry is full of calculations that repeat: molar masses, moles, concentrations and yields. A short Python program can do them quickly and without slips. In this topic you write functions that read a formula such as H2SO4 and add up its molar mass, find the limiting reagent of a reaction, or work out a concentration after dilution. You also load a table of the elements into pandas, filter it, and plot trends such as atomic radius across a period. The computer does the arithmetic, so you can think about the chemistry.
Choose an answer, then check it. Each one shows a full explanation.
A quartz grain is silica. What does this print? d = {"Si": 28.09, "O": 16.00}; print(round(d["Si"] + 2 * d["O"], 2))
Potassium permanganate is read by the formula reader. How many pairs does it find? import re; print(len(re.findall(r"([A-Z][a-z]?)(\d*)", "KMnO4")))
In Ba(NO3)2, how many oxygen atoms does a correct formula reader count?
A student's reader gives {'C': 1, 'O': 1, 'Cl': 2} for cobalt chloride. What did the student type?
Iron burns in chlorine. What does this print? rounds = {"Fe": 0.45, "Cl2": 0.35}; print(min(rounds, key=rounds.get))
In , there are mol of aluminium and mol of chlorine. Which is limiting?
A factory's yield function is called. What does it print? def pct(actual, theory):; return round(100 * actual / theory, 1); print(pct(42, 48))
Copper sulphate solution, 80 mL at 0.35 mol/L: what does this print? print(0.35 * 80 / 1000)
How many mL of a stock make of a solution?
A titration function is called as end_point(0.1, 20), but it is defined as def end_point(acid_M, acid_mL, base_M, ratio=1). What happens?
Each one has a hint, the key idea and a full worked solution.