Home » Posts tagged 'Python immutable data types'

Tag Archives: Python immutable data types

Newly Updated Posts

Data Types in Python

In this tutorial, we are going to learn Data Types in Python.

Python supports several built-in data types, which include:

  1. Numbers: There are two types of numbers in Python – integers and floating-point numbers.
  2. Strings: A string is a sequence of characters. Strings are used to represent text in Python.
  3. Lists: A list is a collection of elements, which can be of any data type. Lists are mutable, meaning they can be changed after creation.
  4. Tuples: A tuple is similar to a list, but is immutable, meaning it cannot be changed once it is created.
  5. Dictionaries: A dictionary is a collection of key-value pairs. Each key is associated with a value, and the keys must be unique.
  6. Sets: A set is an unordered collection of unique elements. Sets are useful when you want to perform operations like union, intersection, and difference on collections.
  7. Booleans: Booleans represent the truth values True and False. They are used to represent logical values in Python.
  8. None: None is a special type in Python that represents the absence of a value. It is commonly used to initialize variables or as a placeholder value.

In addition to these built-in data types, Python also allows you to define your own custom data types using classes.