Interactive Python lesson
Checking Types with type()
Python values come in different kinds: whole numbers, decimal numbers, text, booleans, and even None. This Block shows you how to inspect those values with type(), read outputs like <class 'int'>, and understand what Python is really working with.
You will see how similar-looking values can behave very differently. 25, 25.0, and "25" may look related, but Python sees them as separate types. Tiny quotes, big consequences.
What you will learn:
- Use
type() to check the type of a value
- Recognize beginner-friendly types:
int, float, str, bool, and NoneType
- Check the current type of a variable
- Understand how reassignment can change what type a variable holds
- Spot the difference between values like
True and "True"
- Use
print(type(...)) as a simple debugging tool when a value acts suspicious
By the end, you will have a small but very useful Python flashlight: when something behaves strangely, you can check what type it actually is before blaming the keyboard.