Chapter 2. Arithmetic, Strings, and Variables

The first step in learning how to program is to understand the basic Python data types: integers (whole numbers), floating point numbers (numbers with a decimal point), and strings. All programs use these (and other) data types, so it is important to have a good grasp of their basic uses.

Strings, in particular, are used in so many different kinds of programs that Python provides a tremendous amount of support for them. In this chapter, we’ll just introduce the bare basics of strings, and then we’ll return to them in a later chapter.

We’ll also introduce the important concept of a programming variable. Variables are used to store and manipulate data, and it’s hard to write a useful program without employing ...

Get Python: Visual QuickStart Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.