Variables and data types are the vocabulary of programming. Once these click, the rest of Python gets dramatically easier. The good news is the ideas are simple when you strip away the jargon.
Variables are labeled boxes A variable is just a name attached to a value. Write age = 30 and you have put the number 30 in a box labeled age. Later you can use age anywhere and Python knows you mean 30. You can change what is in the box anytime by assigning a new value.
The core data types Python sorts values into types, and each type behaves differently.
- Strings are text, written in quotes, like "hello"
- Integers and floats are whole numbers and decimals, used for math
- Booleans are True or False, the foundation of decisions
Collections hold many values When you need more than one value, Python offers containers.
- A list holds an ordered sequence, like ["apple", "banana", "cherry"], and you can change it
- A dictionary stores labeled pairs, like {"name": "Sam", "age": 30}, perfect for structured data
Think of a list as a numbered shopping list and a dictionary as a labeled filing cabinet. Choose the one that matches how you need to look things up.