Basic Data Types#

This chapter focuses on the fundamentals of the Python programming language that are needed to write a program or a script. Python has different data types, sets, strings, lists and dictionaries that are important in programming. Python also has several data types including numeric data types and a set of characters called strings that are contained in Python.

Lists in Python are sequences of ordered elements that are mutable. Sets, on the other hand, are Python collections of unordered elements that are immutable. Tuples are also Python elements that describe immutable objects but use parenthesis.

All these elements of Python programming work together in meeting the needs of different programmers in the programming work. These elements help in creating effective Python programs used in several applications.

Python Variables can store data of different types, and different types can do different things and have the following data types built-in by default, in these categories:

  • Sequences

    1. String - str()

    2. List - list()

    3. Tuple - tuple()

    4. Range - rang()

  • Mapping

    1. Dictionary - dict()

  • Set & frozenset - set()

  • Numbers

    1. Integer - int()

      • Boolean Value - bool()

    2. Float - float()

    3. Complex

  • None