who get data type of veriable or an object
Python Data Types
#integer data type
x=5
print(type(x))
#float data type
y=2.4
print(type(y))
#complex data type
z=6j
print(type(z))
#string data type
var="hallo world"
print(type(var))
Try it Yourself »
x=5
print(type(x))
#float data type
y=2.4
print(type(y))
#complex data type
z=6j
print(type(z))
#string data type
var="hallo world"
print(type(var))
Try it Yourself »
Output
<class 'Int'>
<class 'Float'>
<class 'complex'>
<class 'String'>
<class 'Float'>
<class 'complex'>
<class 'String'>
Example | Data Type |
---|---|
x = "hallo world" | string |
x = 2 | int |
x = 3.0 | float |
x = 3j | complex |
x = ['hallo', 'hi', 'gm'] | list |
x = ('hallo', 'hi', 'gm') | tuple |
x = {'mango', 'banana', 'papaya'} | set |
x = {'name':'jack','age':22, 'hobby':'playing'} | dict |
x = range(6) | range |
x = False} | bool |
x = None | none type |
Try it Yourself » |
I have found great and massive information. Thanks for sharing
ReplyDelete