Social Media

12/20/2018

Data Types in Python

Data types define the kind or type of the data.
No declaration is required for data type in python because it is dynamic typed language.
Python has 14 built in data types. These are given below:
int, float, complex, bool, str, bytes, bytearray, range, list, tuple, set, frozenset, dict, Nonetype

Numbers: There are 3 built in data types for numbers
1. Integers (int)
2. Floating Point Numbers (float)
3. Complex Numbers (complex)

Strings(str):
Strings are denoted using quotes (single, double or even triple)
a='Mayank'
x="MAYANK"
y="""Mayank"""

These all are treated as string in python language.

Boolean:
The boolean variable can have either True or False.
x=True
y=False
print(type(x)) #bool


The datatypes which falls under the category of sequential data types are as:
str, bytes, bytearray, range, list, tuple



Be First to Post Comment !
Post a Comment