How can I use Python to get the type of a variable at runtime?

I’ve been working with Python for a while, and one of the quickest ways I check a variable’s type is by using the built-in type() function. It’s super straightforward. Here’s an example:

x = 42
print(type(x))  # Output: <class 'int'>

This gives you the exact type of the variable, like int, str, list, etc. It’s really handy when debugging or just checking types during development.