Introduction
This chapter will expand our understanding of programming by introducing types and literals. All objects in Python have a type, and literals are fixed values of a given type. For example, the literal 1
is an integer and is of type int
(short for “integer”). Python has many different types.
Learning objectives
- You will learn about many commonly used types in Python.
- You will understand why we have different types.
- You will be able to write literals of various types.
- You will learn different ways to write string literals which include various quotation marks within them.
- You will learn about representation error as it applies to numeric types (especially floating-point values).
Terms introduced
- dynamic typing
- escape sequence
- empty string, empty tuple, and empty list
- heterogeneous
- literal
- representation error
- static typing
- “strong” vs “weak” typing
- type (including
int
,float
,str
,list
,tuple
,dict
, etc.) - type inference
- Unicode
Copyright © 2023–2025 Clayton Cafiero
No generative AI was used in producing this material. This was written the old-fashioned way.