Python Basics
Summary Table
Summary of the Python Basics section.
Concept | Example | Description |
---|---|---|
int |
10 |
Integer |
float |
3.14 |
Floating point number |
bool |
True , False |
Boolean value |
str |
"hello" |
String |
None |
None |
Null or no value |
Assignment | x = 10 |
Assigns value to a variable |
Naming | user_name = "Bob" |
Follows naming rules |
Reassignment | x = x + 1 |
Updates variable value |
Multiple Assignment | a, b = 1, 2 |
Assign multiple variables at once |
Dynamic Assignment | x = 5 → x = "hello" |
Variable type can change during execution |
list |
[1, 2, 3] |
Mutable sequence |
tuple |
(1, 2) |
Immutable sequence |
set |
{1, 2, 3} |
Unordered unique elements |
dict |
{'key': 'value'} |
Key-value mapping |