According to the standard atomic model1, an atom consists of a nucleus surrounded by orbiting electrons.

A chemical element has an atomic nucleus consisting of a fixed number of protons and a variable number of neutrons. The number of protons determines the atomic number of the element and its chemical properties. The number of neutrons determines, among other things, the stability of the nucleus and — together with the number of protons — the atomic mass. Each element has a unique name consisting of an uppercase letter followed by one or more lowercase letters (e.g. Tungsten, Lead, Mercury, Helium) and a unique symbol consisting of an uppercase letter followed by zero or more lowercase letters (e.g. W, Pb, Hg, He).
Isotopes are atoms of the same chemical element — so they have the same number of protons but a different number of neutrons in their atomic nucleus. An isotope is denoted by its mass number (the number of protons and neutrons in the nucleus) in superscript to the left of the element's chemical symbol (e.g. $${}^{3}\mathrm{He}$$, $${}^{4}\mathrm{He}$$, $${}^{12}\mathrm{C}$$, $${}^{14}\mathrm{C}$$, $${}^{235}\mathrm{U}$$, $${}^{239}\mathrm{U}$$).
Which famous chemist is hidden in this sequence of isotopes? \[ {}^{281}\mathrm{Mt}\,{}^{203}\mathrm{Tl}\,{}^{202}\mathrm{Hg}\,{}^{249}\mathrm{Es}\,{}^{291}\mathrm{Fl}\,{}^{247}\mathrm{Cm}\,{}^{167}\mathrm{Er}\,{}^{93}\mathrm{Zr}\,{}^{251}\mathrm{Cf}\,{}^{146}\mathrm{Nd} \]
Answer: Marie Curie
For each isotope $${}^{n}\mathrm{s}$$ with mass number $$n$$ and element with symbol $$s$$, we take the $$n$$-th letter from the name of the element (we continue counting from the start of the name after reaching the end). As such, M is letter 281 in Meitnerium (Mt), a is letter 203 in Thallium (Tl), and r is letter 202 in Mercury (Hg). If we concatenate the letters for all isotopes, we get MarieCurie.
We represent a sequence of isotopes that hides the name of a famous chemist as a string (str) consisting of the alternating sequence of mass numbers (digit sequences) and symbols (letter sequences) from the isotope notations. For example, the sequence of isotopes \[ {}^{281}\mathrm{Mt}\,{}^{203}\mathrm{Tl}\,{}^{202}\mathrm{Hg}\,{}^{249}\mathrm{Es}\,{}^{291}\mathrm{Fl}\,{}^{247}\mathrm{Cm}\,{}^{167}\mathrm{Er}\,{}^{93}\mathrm{Zr}\,{}^{251}\mathrm{Cf}\,{}^{146}\mathrm{Nd} \] that hides the name Marie Curie, is represented as the string
281Mt203Tl202Hg249Es291Fl247Cm167Er93Zr251Cf146Nd
To find the chemist hidden in the sequence of isotopes, we need the names of the chemical elements whose symbol appears in the sequence of isotopes. For this purpose, we use a text file in which each line describes some properties of a single chemical element, with information fields separated by a character that otherwise does not appear elsewhere in the information fields. The file contains at least information about elements whose symbol appears in the sequence of isotopes, and contains at least information fields with the name and the symbol of the elements. The order of the information fields is not fixed. The first line of the file may consist of a header with descriptive names for the information fields.
For example, this is part of a file (elements.txt2) containing information about all known chemical elements. The file has a header, and each line consists of 15 tab-separated information fields. The second field contains the symbol for the elements, and the third field contains their name.
Atomic number Symbol Name Group Period Block Atomic weight (Da) Density (g/cm3) Melting point (K) Boiling point (K) Specific heat capacity (J/g · K) Electro-negativity Abundance in Earth's crust (mg/kg) Origin Phase
…
40 Zr Zirconium 4 5 d-block 91.224 6.52 2128 4682 0.278 1.33 165 primordial solid
…
60 Nd Neodymium f-block groups 6 f-block 144.24 7.01 1297 3347 0.19 1.14 41.5 primordial solid
…
68 Er Erbium f-block groups 6 f-block 167.26 9.066 1802 3141 0.168 1.24 3.5 primordial solid
…
80 Hg Mercury 12 6 d-block 200.59 13.534 234.43 629.88 0.14 2.00 0.085 primordial liquid
81 Tl Thallium 13 6 p-block 204.38 11.85 577 1746 0.129 1.62 0.85 primordial solid
…
96 Cm Curium f-block groups 7 f-block [247] 13.51 1613 3383 – 1.28 – synthetic solid
97 Bk Berkelium f-block groups 7 f-block [247] 14.78 1259 2900 – 1.3 – synthetic solid
98 Cf Californium f-block groups 7 f-block [251] 15.1 1173 (1743) – 1.3 – synthetic solid
99 Es Einsteinium f-block groups 7 f-block [252] 8.84 1133 (1269) – 1.3 – synthetic solid
…
109 Mt Meitnerium 9 7 d-block [278] (27–28) – – – – – synthetic unknown phase
…
114 Fl Flerovium 14 7 p-block [289] (11.4±0.3) (284±50) – – – – synthetic unknown phase
…
Your task:
Write a function select_letter that takes two arguments: i) a number $$n \in \mathbb{N}_0$$ (int) and ii) a string $$s$$ (str) that only contains letters (uppercase and lowercase letters). The function must return the $$n$$-th letter (str) of string $$s$$, if we start counting from 1 at the first letter of string $$s$$ and continue counting from the start of string $$s$$ after reaching the end.
Write a function isotopes that takes the string representation (str) of a sequence of isotopes. The function must return a list containing a tuple for each isotope in the sequence, with the mass number (int) and the symbol (str) of the isotope.
Write a function read_elements that takes three arguments: i) the location (str) of a text file containing properties of chemical elements, ii) the index (int) of the information field containing the symbols for the elements and iii) the index (int) of the information field containing the names of the elements. Information fields are numbered from left to right, starting at 1. The function also has an optional parameter separator that may take the field separator (str). If no separator is passed explicitly, the information fields are tab-separated. The function also has an optional parameter header that takes a Boolean value (bool; default value: True), indicating whether the first line of the file is a header. The function must return a dictionary (dict) that maps the symbol (str) for each element described in the file onto the name (str) of the element.
Write a function chemist that takes two arguments: i) the string representation (str) of a sequence of isotopes that hides the name of a famous chemist and ii) a dictionary (dict) mapping symbols (str) of chemical elements onto their names (str). The function may assume that the symbol of each isotope in the sequence is a key in the dictionary, without the need to check this explicitly. The function must return the chemist (str) hidden in the given sequence of isotopes.
In this interactive session, we assume the current directory contains the text file elements.txt3.
>>> select_letter(281, 'Meitnerium')
'M'
>>> select_letter(203, 'Thallium')
'a'
>>> select_letter(202, 'Mercury')
'r'
>>> isotopes('281Mt203Tl202Hg249Es291Fl247Cm167Er93Zr251Cf146Nd')
[(281, 'Mt'), (203, 'Tl'), (202, 'Hg'), (249, 'Es'), (291, 'Fl'), (247, 'Cm'), (167, 'Er'), (93, 'Zr'), (251, 'Cf'), (146, 'Nd')]
>>> isotopes('121Sb232Ac107Ag139Nd137Pr163Ho225Ac261Md258No290Og20Mg115Cd238Am36Cl')
[(121, 'Sb'), (232, 'Ac'), (107, 'Ag'), (139, 'Nd'), (137, 'Pr'), (163, 'Ho'), (225, 'Ac'), (261, 'Md'), (258, 'No'), (290, 'Og'), (20, 'Mg'), (115, 'Cd'), (238, 'Am'), (36, 'Cl')]
>>> symbol2name = read_elements('elements.txt4', 2, 3)
>>> symbol2name['Mt']
'Meitnerium'
>>> symbol2name['Tl']
'Thallium'
>>> symbol2name['Hg']
'Mercury'
>>> chemist('281Mt203Tl202Hg249Es291Fl247Cm167Er93Zr251Cf146Nd', symbol2name)
'MarieCurie'
>>> chemist('121Sb232Ac107Ag139Nd137Pr163Ho225Ac261Md258No290Og20Mg115Cd238Am36Cl', symbol2name)
'AmedeoAvogadro'
In 1994, 17-year-old Boy Scout David Hahn5 decided to build a nuclear breeder reactor in his backyard shed in Michigan. He gathered radioactive material from smoke detectors, camping lanterns, clocks and gunsights, hoping to transform them into fissionable isotopes in a hollowed-out block of lead.
He should have stuck to homework. The experiment started to emit toxic levels of radiation, and he was trying to dismantle it when the police found him and brought in the FBI and the Nuclear Regulatory Commission6. To his mother’s dismay, her property was declared a Superfund7 hazardous materials cleanup site, and the shed was moved to Utah and buried as low-level radioactive waste.
On the bright side, Hahn made Eagle Scout8.