Home » Posts tagged 'Python numeric data types'
Tag Archives: Python numeric data types
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:
- Numbers: There are two types of numbers in Python – integers and floating-point numbers.
- Strings: A string is a sequence of characters. Strings are used to represent text in Python.
- 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.
- Tuples: A tuple is similar to a list, but is immutable, meaning it cannot be changed once it is created.
- Dictionaries: A dictionary is a collection of key-value pairs. Each key is associated with a value, and the keys must be unique.
- 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.
- Booleans: Booleans represent the truth values True and False. They are used to represent logical values in Python.
- 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.