Azad Rasul
SmartRS

Follow

SmartRS

Follow

6- Types of data in Python

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

1 min read

Play this article

Variables in Python

  • Variables 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- Float:

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

3- 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:

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

2- list:

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

3-set:

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

4- dict: dictionary

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

5- range:

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

If you like the content, please SUBSCRIBE to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7

 
Share this