Back to programming
programming#python#beginner

Python for Absolute Beginners

The absolute essentials of Python — variables, if, loops and functions — in the clearest possible words, with runnable examples.

Jane Contributor August 2, 2026 1 views

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

Discussion (0)

No comments yet. Be the first to weigh in.

Leave a comment

Comments are reviewed before appearing.