In Part 1, we understood what Python is and why it exists. In this part, we enter the real foundation of programming: variables, data types, and memory thinking.
A variable is a name that points to a value stored in memory. Python does not think in terms of boxes — it thinks in terms of references.
x = 10
name = "Python"
Here:
x points to number 10name points to text "Python"Python does not force you to declare data types. The type is decided automatically at runtime.
value = 10
print(type(value))
value = "Ten"
print(type(value))
Same variable name, different data types — Python allows this.
age = 25 # int
price = 99.99 # float
language = "Python" # str
is_active = True # bool
Python variables do not store values directly. They store references to objects in memory.
a = 5
b = a
a = 10
print(a)
print(b)
Output:
10
5
Explanation:
b still points to old object 5a now points to new object 10
user_name = "Suraj" # valid
_age = 25 # valid
2name = "Wrong" # invalid
user-name = "Wrong" # invalid
If you do not understand variables and data types, loops, functions, APIs, and AI code will feel like magic. Strong programmers think in memory and flow — not syntax.
In the next part, we will learn operators and expressions — how Python actually performs calculations and decisions.