Introduction

Published

2023-07-31

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

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

This material is for free use under either the GNU Free Documentation License or the Creative Commons Attribution-ShareAlike 3.0 United States License (take your pick).