Python datatypes

Python automatically determines the data type based on the value assigned to it. You can find the datatype of a variable using type() function.

Python datatypes

Datatypes are used to hold different types of values. Python supports the following five standard datatypes.

Python automatically determines the data type based on the value assigned to it. You can find the datatype of a variable using type() function.

Example

a=10;
print(type(a)) #int datatype
a='John'
print(type(a)) #string datatype

Output

<class 'int'>
<class 'str'>


Share Tweet Send
Loading...
You've successfully subscribed to Geekinsta
Great! Next, complete checkout for full access to Geekinsta
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.