How to Check Type in Python
In this article, we will learn to check type in Python.
The built-in function type()
can be used to check the type of data in Python.
>>> a = 10.32 >>> type(a) <class 'float'> >>> b = 898989666565 >>> type(b) <class 'int'> >>> c = [1, 3, 5] >>> type(c) <class 'list'> >>> d = (2, 4, 1) >>> type(d) <class 'tuple'> >>> e = {1: 'one'} >>> type(e) <class 'dict'>
Subscribe
Login
Please login to comment
0 Discussion