Python Dynamic Typing
Question
In Python, what happens when you run `x = 10` followed by `x = "hello"`?
Hint
Python is dynamically typed.
Explanation
Python is dynamically typed, which means a variable can hold values of different types at different times. When you run x = "hello", the variable x simply points to the new string value. No error occurs. This is different from statically typed languages like Java, where each variable has a fixed type.
Related Resources
Related Lessons
- Python Data Types
Learn about Python data types and dynamic typing.
Related Cheatsheets
- Python Cheatsheet
Quick reference for Python data types.
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.