Python has many built-in data types:
- Text:
str - Numbers:
int,float,complex - Sequences:
list,tuple,range - Mapping:
dict - Sets:
set,frozenset - Boolean:
bool - None:
NoneType
Use type() to see a value's type.
Built-in types and how to check them.
✍️ 3 exercises + code challenge in this lessonPython has many built-in data types:
strint, float, complexlist, tuple, rangedictset, frozensetboolNoneTypeUse type() to see a value's type.
Mastering Python Data Types helps you write clean and reliable Python code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
values = ["text", 20, 20.5, 1j, ["a", "b"], ("a", "b"), range(3),
{"name": "Sara"}, {"a", "b"}, True, None]
for v in values:
print(repr(v).ljust(18), type(v).__name__)
Check what you learned in “Python Data Types”.
Get the type of a value.
(42)
What is the type of 3.14?
Print the name of the type of [1, 2] (it should print list).
Free sign-in required · Google login available
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services