Python for Absolute Beginners
The absolute essentials of Python — variables, if, loops and functions — in the clearest possible words, with runnable examples.
Series
Python from Scratch
Python for Absolute Beginners
Python is a friendly programming language — no semicolons, no curly braces, easy words like if, for, def.
Install and open a REPL
python3 # opens an interactive shell
>>> 2 + 2
4
>>> exit()
Variables
name = "Priya"
age = 20
is_student = True
No types to declare — Python figures it out.
if / elif / else
score = 78
if score >= 90:
grade = "A"
elif score >= 70:
grade = "B"
else:
grade = "C"
print(grade) # B
Indentation matters — the block is defined by 4-space indent, not braces.
Loops
# for over a list
for city in ["Delhi", "Bangalore", "Chennai"]:
print(city)
# for over numbers
for i in range(5): # 0..4
print(i)
# while
n = 1
while n < 100:
n *= 2
print(n) # 128
Functions
def greet(name, greeting="Hello"):
return f"{greeting}, {name}!"
print(greet("Rahul")) # Hello, Rahul!
print(greet("Aisha", "Namaste")) # Namaste, Aisha!
Real-world tip
Type help(len) in the REPL — Python's documentation is one keystroke away. Beginners who use help() learn twice as fast.
Keep reading
You may also like
programming
Kafka Beyond Basics: Consumer Groups, Replication, Ordering
The three intermediate concepts that turn Kafka from a toy into a production tool.
programming
YAML Explained with Examples
YAML is everywhere in DevOps (Docker Compose, Kubernetes, GitHub Actions). Learn its 6 rules and you're done.
programming
Python Async: A Practical Guide
asyncio, event loops and when NOT to use async.
Discussion (0)
No comments yet. Be the first to weigh in.