Python Variable Types
Multiple Choice Beginner
Question
How are variable types determined in Python?
Hint
Python is dynamically typed.
Explanation
Python is dynamically typed — variable types are determined at runtime based on the assigned value. A variable can hold different types over its lifetime: x = 5; x = "hello" is valid. Type hints (x: int = 5) are optional annotations for documentation and tooling, not enforcement. Use mypy for static type checking.
Related Resources
Related Lessons
- Variables
Learn Python variables.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.