SECTION
1
Getting Started with Python
From a first calculation to a working Python setup: everything you need before writing real programs.
Section opener. Chemistry on one side, code on the other. This section joins them.
Overview
This section starts with a calculation you already know how to do by hand, the molar mass of a compound, and lets Python do it for you. Once you have seen what a few lines of code can do, we set up a proper working environment, learn to run scripts, and learn to read the error messages that every programmer meets on the first day.
[A second paragraph connecting this section to the rest of the volume.]
In this section you will
- use Python as a calculator for a real chemical quantity;
- install Python and Jupyter, and run code in both;
- keep track of units and significant figures in a program;
- read a traceback and fix the most common beginner errors.
Units
Read them in order. Each unit builds on the one before it.
- 1.1Your First Calculation: Molar MassCompute the molar mass of ethanol in four lines of Python, and meet variables along the way.3 min · 1 worked example · 3 exercises
- 1.2Installing Python and Jupyter[One-sentence description of the unit.]1 min
- 1.3Running a Script[One-sentence description of the unit.]1 min
- 1.4Numbers, Units and Rounding[One-sentence description of the unit.]1 min
- 1.5Reading Error Messages[One-sentence description of the unit.]1 min
Key terms in this section
variable · expression · float · integer · interpreter · notebook · script · traceback
END OF SECTION
Section summary · one page, for revision
Problems for Section 1 · [n] problems with answers