Azad Rasul




6- Types of data in Python

Azad Rasul's photo
Azad Rasul
·Jun 26, 2021·

2 min read

Play this article

Variables in Python

  • Variables are dynamically typed in Python.

  • Python is case sensitive; it differentiates between capital (Erbil) and small letters (erbil).

  • The first letter of variables cannot start with digits (i.e. 3Erbil).

Main data types in Python

  1. Integers: int
Age = 55 
type(Age) # class 'int'

2- Floats: float

x = 22.5
type(x) # class ‘float’

3- Complex: complex

z = 5 + 10j
type(z) # class 'complex'

4- Boolean: bool is true or false

isFactor = False
type(isFactor) # class 'bool'

5- Strings: str

name = "Anas"
type(name) # class 'str'

6- Nothing: NoneType

precipitation = None
type(precipitation) # class 'NoneType'

Container data types in Python:

1- Tuple: tuple

color = ("red", "blue", "green")
type(color) # class 'tuple'

2- List: list

Color = ["red", "blue", "green"]
type(Color) # class 'list'

3- Set: set

food = set(["rice" , "egg", "yogurt"])
type(food) # class 'set'

4- Dictionary: dict

age = {'Anas': '8', 'Aviar': '6', 'Muhammad': '5'}
type(age) # class 'dict'

5- Range: range

y = range(100)
type(y) # class 'range'

If you find this content helpful, please consider SUBSCRIBING to my channel for future updates.

If you would like to get the full video tutorial and a certificate, you can enroll in the course by following this link:

Did you find this article valuable?

Support Azad Rasul by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
Share this