DATA TYPES
Data types defines which type of data is used or stored in a variable, such as a :- number, alphabet or string. Each data type has a different size
These are some common data type of python
Name |
Type |
Size (in bytes) |
Description |
Integers |
Int |
4 |
Numbers such as: 4, 458 |
Long |
8 |
||
Floating point |
Float |
4 |
Numbers with decimal point such as: 48.5 |
String |
String |
|
Sequence of character: Nice to meet you Mr.
Python |
Boolean |
Bool |
1 |
True or false (0 or 1) |
How to find data type of object?
You can find by using below code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Simple code to check data type | |
# type(object) is inbuilt func. used to find the data type of object | |
print(type(5)) #integer | |
print(type("Coding needs")) #string | |
print(type(True)) #boolean | |
print(type(98.6)) #float |
0 Comments