Skip to content

Data Types and Variables

Introduction

This chapter is about Python data types. Python has many built-in data types such as integers, floats, booleans, strings, and lists.

By the end of this chapter you will be able to:

  • Explain the difference between Python's built-in data types

  • Define variables with the assignment operator =

  • Create variables with different data types

  • Use Python's type() function to determine an object's data type

  • Compare variables with the comparison operator ==

  • Convert variables from one data type to another

  • Work with integers, floats and complex numbers

  • Understand the boolean data type

  • Create and modify lists, dictionaries and tuples

  • Index and slice strings, lists and tuples