📚 10 Lessons • Free

Ultimate Python Guide

Learn Python from scratch with this complete beginner‑friendly guide. No prior coding experience needed.

📖 Table of Contents

1.1 Your First Python Program

Learn how to write your very first Python program using print() and variables.

print("Hello, World!")

Full lesson →

1.2 Variables & Data Types

Variables store data. Python has several built‑in data types.

name = "Alice"
age = 30
height = 5.9
is_student = True

Full lesson →

1.3 Lists & Tuples

Lists are mutable collections; tuples are immutable.

fruits = ["apple", "banana", "cherry"]
fruits.append("orange")
fruits.remove("banana")

coordinates = (10, 20)

Full lesson →

1.4 Conditional Statements

Use if, elif, and else to make decisions.

score = 85
if score >= 90:
    print("Grade: A")
elif score >= 80:
    print("Grade: B")
else:
    print("Grade: C")

Full lesson →

1.5 Loops (for/while)

Loops repeat code.

# for loop
for i in range(5):
    print(i)

# while loop
count = 0
while count < 5:
    print(count)
    count += 1

Full lesson →

1.6 Functions

Functions are reusable blocks of code.

def greet(name):
    return f"Hello, {name}!"

result = greet("Alice")
print(result)

Full lesson →

1.7 String Methods & Formatting

Strings have many built‑in methods and can be formatted with f‑strings.

text = "  Hello World!  "
print(text.upper())       # "  HELLO WORLD!  "
print(text.lower())       # "  hello world!  "
print(text.strip())       # "Hello World!"

name = "Alice"
age = 30
print(f"My name is {name} and I'm {age} years old.")

Full lesson →

1.8 Dictionaries

Dictionaries store key‑value pairs.

person = {
    "name": "Alice",
    "age": 30,
    "city": "Lahore"
}

print(person["name"])
person["age"] = 31
person["country"] = "Pakistan"

Full lesson →

1.9 Error Handling

Handle exceptions gracefully with try/except.

try:
    num = int(input("Enter a number: "))
    print(f"You entered: {num}")
except ValueError:
    print("That's not a valid number!")

Full lesson →

1.10 Project: Calculator

Apply everything you've learned to build a functional calculator.

Full lesson →

📤 Share this guide

🚀 Want to go further?

Explore the full Python course with interactive demos, code examples, and challenges.

Full Python Course →