Introduction

Learning Python in 30 days is ambitious — and perfectly achievable if you follow a focused plan, code every day, and build real projects. This guide condenses decades of teaching and writing experience into a practical roadmap: daily topics, targeted exercises, mini-projects that lock learning in, and study habits that accelerate progress. After 30 days you won’t be an expert, but you’ll be productive, confident, and ready to deepen skills for web development, automation, or data analysis.

Why Python?
Python’s popularity is no accident. It’s readable (which makes it beginner-friendly), versatile (web, data, automation, scripting, ML), and supported by a huge ecosystem of libraries. Because the syntax is uncluttered, you can focus on problem solving instead of syntax headaches. That’s why Python is the fastest route from “I want to learn” to “I can build something useful.”

Who should follow this plan?

  • Complete beginners who want a practical start.

  • Engineers switching languages who want a rapid ramp.

  • Busy people who can commit 1–2 hours daily (or 3–4 hours for faster progress).

  • Learners who prefer doing small, useful projects rather than reading theory only.

Key SEO keywords used organically: learn Python in 30 days, Python for beginners, Python crash course, Python programming, 30-day Python challenge, learn Python fast, Python tutorials, Python projects for beginners.


How to use this guide

  1. Follow the daily topics and code the exercises.

  2. Treat mini-projects as real — add a README, validate input, and test.

  3. Keep a short daily log: what you learned, one confusion, one experiment.

  4. Review weekly; repetition turns short-term knowledge into skill.

Setup (Day 0 — 30–60 minutes)

  • Install the latest stable Python 3.x from python.org.

  • Install VS Code (or another editor) and learn to run scripts from the terminal.

  • Create a GitHub account and one repository for your 30-day projects.

  • Learn virtual environments (python -m venv venv) to isolate packages.

Pro tip: Use venv for each project — it avoids dependency conflicts and teaches best practices from day one.

30-Day Plan — Overview
The month is split into four focused weeks: Fundamentals, Core Python & Data Handling, Object-Oriented & Libraries, Applied Python & Capstone. Daily commitment: 1–2 hours. If you can do 3–4 hours, add depth and extra exercises.


Week 1 — Fundamentals (Days 1–7)
Goal: Understand syntax, control flow, and basic data structures.

Day 1: Hello Python — REPL, print, comments, variables.
Exercise & Code (save as hello_world.py and run python hello_world.py):

# hello_world.py name = input("What's your name? ").strip() print(f"Hello, {name}! Welcome to Day 1 of learning Python.")

Day 2: Numbers and strings — arithmetic, string methods, f-strings.
Exercise & Code (temp_converter.py):

# temp_converter.py val = float(input("Enter temperature: ")) unit = input("Is this Celsius or Fahrenheit? (C/F): ").strip().upper() if unit == "C": f = val * 9/5 + 32 print(f"{val:.2f}°C = {f:.2f}°F") else: c = (val - 32) * 5/9 print(f"{val:.2f}°F = {c:.2f}°C")

Day 3: Booleans & conditionals — if, elif, else.
Exercise & Code (age_category.py):

# age_category.py age = int(input("Enter your age: ")) if age < 13: cat = "child" elif age < 20: cat = "teen" elif age < 60: cat = "adult" else: cat = "senior" print(f"You are a(n) {cat}.")

Day 4: Loops — for, while, range.
Exercise & Code (mult_table.py):

# mult_table.py n = int(input("Enter a number for multiplication table: ")) for i in range(1, 11): print(f"{n} x {i} = {n*i}")

Day 5: Lists — indexing, slicing, methods (append, pop, sort).
Exercise & Code (todo.py):

# todo.py todos = [] while True: cmd = input("(a)dd/(r)emove/(l)ist/(q)uit: ").strip().lower() if cmd == "a": todos.append(input("Task: ").strip()) elif cmd == "r": i = int(input("Index to remove (starting 0): ")) if 0 <= i < len(todos): todos.pop(i) else: print("Invalid index.") elif cmd == "l": for idx, t in enumerate(todos): print(idx, t) elif cmd == "q": break else: print("Unknown command.")

Day 6: Tuples & sets — immutability and uniqueness.
Exercise & Code (dedupe.py):

# dedupe.py names = ["ram", "sita", "ram", "geeta", "sita"] unique = list(set(names)) print("Original:", names) print("Unique:", unique)

Day 7: Dictionaries — key/value mapping, iteration.
Mini project & Code (contacts.py):

# contacts.py contacts = {} while True: cmd = input("add/get/list/quit: ").strip().lower() if cmd == "add": name = input("Name: ").strip() phone = input("Phone: ").strip() contacts[name] = phone elif cmd == "get": name = input("Name: ").strip() print(contacts.get(name, "Not found")) elif cmd == "list": for k,v in contacts.items(): print(k, ":", v) elif cmd == "quit": break else: print("Unknown command.")

Weekly review: Rebuild two exercises, push them to GitHub, and write a short README.


Week 2 — Core Python & Data Handling (Days 8–14)
Goal: Learn functions, modules, file I/O, comprehensions, and error handling.

Day 8: Functions — parameters, return values, scope.
Exercise & Code (functions.py):

# functions.py def factorial_iter(n): result = 1 for i in range(2, n+1): result *= i return result def factorial_rec(n): return 1 if n <= 1 else n * factorial_rec(n-1) n = int(input("Factorial of: ")) print("Iterative:", factorial_iter(n)) print("Recursive:", factorial_rec(n))

Day 9: Modules & standard library — math, random, datetime.
Exercise & Code (password.py):

# password.py import random, string def random_password(length=12): chars = string.ascii_letters + string.digits + string.punctuation return ''.join(random.choice(chars) for _ in range(length)) length_input = input("Length (default 12): ").strip() length = int(length_input) if length_input else 12 print(random_password(length))

Day 10: File I/O — read & write text/JSON files.
Exercise & Code (contacts_json.py):

# contacts_json.py import json F = "contacts.json" contacts = {} try: with open(F, "r") as f: contacts = json.load(f) except FileNotFoundError: contacts = {} # Example: add or update contacts["alice"] = "+91-99999" with open(F, "w") as f: json.dump(contacts, f, indent=2) print("Saved contacts:", contacts)

Day 11: List comprehensions & generators — concise, efficient patterns.
Exercise & Code (comprehension.py):

# comprehension.py squares = [x*x for x in range(1, 11)] print("Squares:", squares) def fib_gen(n): a,b=0,1 for _ in range(n): yield a a,b = b, a+b print("Fibonacci (first 10):", list(fib_gen(10)))

Day 12: Error handling — try, except, finally.
Exercise & Code (safe_file.py):

# safe_file.py path = input("Enter filename to open: ").strip() try: with open(path, "r") as f: print(f.read()[:500]) except FileNotFoundError: print("File not found:", path) except Exception as e: print("Error:", e)

Day 13: CSV handling — parsing tabular data.
Exercise & Code (csv_read.py) — create a CSV with header amount to test:

# csv_read.py import csv path = input("CSV path: ").strip() total = 0.0 count = 0 try: with open(path, newline='') as csvfile: reader = csv.DictReader(csvfile) for row in reader: val = float(row.get("amount", 0) or 0) total += val count += 1 print("Rows:", count, "Total amount:", total) except FileNotFoundError: print("CSV not found:", path)

Day 14: Project — Command-line expense tracker that saves to CSV.
Exercise & Code (expense.py):

# expense.py import csv, datetime F="expenses.csv" def add_expense(amount, note): with open(F, "a", newline='') as f: writer = csv.writer(f) writer.writerow([datetime.date.today().isoformat(), amount, note]) amount = input("Amount: ").strip() note = input("Note: ").strip() add_expense(amount, note) print("Saved to", F)

Weekly review: Add input validation to your expense tracker and write simple unit tests for core functions.


Week 3 — Object-Oriented & Useful Libraries (Days 15–21)
Goal: Learn OOP, packages, and start using third-party libraries.

Day 15: OOP basics — classes, instances, attributes, methods.
Exercise & Code (task.py):

# task.py class Task: def __init__(self, title, done=False): self.title = title self.done = done def mark_done(self): self.done = True def __str__(self): return f"[{'x' if self.done else ' '}] {self.title}" t = Task("Learn Python") print(t) t.mark_done() print(t)

Day 16: Inheritance & composition — design for reuse.
Exercise & Code (timed_task.py):

# timed_task.py import datetime class Task: def __init__(self, title): self.title = title class TimedTask(Task): def __init__(self, title, due_date): super().__init__(title) self.due_date = due_date def is_overdue(self): return datetime.date.today() > self.due_date tt = TimedTask("Submit report", datetime.date(2025, 8, 20)) print("Overdue?", tt.is_overdue())

Day 17: Environments & pip — install and manage packages.
Shell steps and test code:

# In shell: python -m venv venv # Activate: # Linux/Mac: source venv/bin/activate # Windows: .\venv\Scripts\activate pip install requests
# test_requests.py import requests print("requests version:", requests.__version__)

Day 18: Web APIs with requests — fetch and parse JSON.
Exercise & Code (api_fetch.py):

# api_fetch.py import requests try: r = requests.get("https://jsonplaceholder.typicode.com/todos/1", timeout=5) r.raise_for_status() data = r.json() print("Title:", data.get("title")) except Exception as e: print("Request failed:", e)

Day 19: Intro to pandas — DataFrame basics (optional for data work).
Install and code (pandas_summary.py):

pip install pandas
# pandas_summary.py import pandas as pd df = pd.read_csv("expenses.csv") # ensure the file exists print(df.head()) print(df.groupby(df['date'].str[:7])['amount'].sum())

Day 20: Dates & scheduling — datetime and automation.
Exercise & Code (reminder.py):

# reminder.py import datetime tasks = [{"title":"Pay bill","due":"2025-08-01"}, {"title":"Call mom","due":"2025-08-20"}] today = datetime.date.today() for t in tasks: due = datetime.date.fromisoformat(t["due"]) if due <= today: print("Overdue:", t["title"]) elif (due - today).days <= 3: print("Due soon:", t["title"], "in", (due-today).days, "days")

Day 21: Project — Notes manager or small CLI CRUD app.


Exercise & Code (notes.py):

# notes.py import json, os F="notes.json" notes = json.load(open(F)) if os.path.exists(F) else [] notes.append({"title":"Day21", "content":"Learned CRUD."}) with open(F, "w") as f: json.dump(notes, f, indent=2) print("Notes count:", len(notes))

Weekly review: Push the project to GitHub and write a README that shows how to run it.


Week 4 — Applied Python & Capstone (Days 22–30)
Goal: Build real tools: scraping, testing, web apps, visualization, packaging.

Day 22: Web scraping basics — requests + BeautifulSoup.
Install and Code (scrape.py):

pip install requests beautifulsoup4
# scrape.py import requests from bs4 import BeautifulSoup r = requests.get("https://example.com", timeout=5) soup = BeautifulSoup(r.text, "html.parser") print("Title:", soup.title.string)

(Always check robots.txt and site terms before scraping.)

Day 23: Testing — unittest or pytest.
Install and example test:

pip install pytest

task_for_test.py:

# task_for_test.py class Task: def __init__(self, title): self.title = title self.done = False def mark_done(self): self.done = True

test_task.py:

# test_task.py from task_for_test import Task def test_mark_done(): t = Task("x") t.mark_done() assert t.done

Run with pytest -q.

Day 24: Minimal Flask app to serve data.
Install and code (app.py):

pip install flask
# app.py from flask import Flask, jsonify app = Flask(__name__) contacts = {"ram":"9999", "sita":"8888"} @app.route("/") def home(): return "Hello from Flask" @app.route("/contacts") def get_contacts(): return jsonify(contacts) if __name__ == "__main__": app.run(debug=True, port=5000)

Open http://127.0.0.1:5000/contacts


Day 25: Plotting with matplotlib.
Install and code (plot_expenses.py):

pip install matplotlib pandas

# plot_expenses.py import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("expenses.csv") monthly = df.groupby(df['date'].str[:7])['amount'].sum() monthly.plot(kind='bar') plt.title("Monthly Expenses") plt.tight_layout() plt.savefig("monthly_expenses.png") print("Saved monthly_expenses.png")

Day 25: Plotting with matplotlib.
Install and code (plot_expenses.py):

pip install matplotlib pandas
# plot_expenses.py import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("expenses.csv") monthly = df.groupby(df['date'].str[:7])['amount'].sum() monthly.plot(kind='bar') plt.title("Monthly Expenses") plt.tight_layout() plt.savefig("monthly_expenses.png") print("Saved monthly_expenses.png")

Day 26: Packaging & distribution basics (local install).
Example setup.py snippet and steps:

# setup.py from setuptools import setup, find_packages setup( name="mytool", version="0.1", packages=find_packages(), entry_points={"console_scripts": ["mytool=mytool.cli:main"]}, )

Then in the project folder:

pip install -e . # Now run: mytool

Day 27: Profiling & simple optimization (timeit_example.py):

# timeit_example.py import timeit setup = "data = list(range(10000))" stmt_loop = "s=[]\nfor x in data: s.append(x*2)" stmt_comp = "[x*2 for x in data]" print("Loop:", timeit.timeit(stmt_loop, setup=setup, number=100)) print("Comprehension:", timeit.timeit(stmt_comp, setup=setup, number=100))

Days 28–30: Capstone scaffold — a simple Flask notes API (capstone/app.py):

pip install flask sqlalchemy
# capstone/app.py from flask import Flask, request, jsonify app = Flask(__name__) notes = [] @app.route("/notes", methods=["GET","POST"]) def notes_route(): if request.method == "POST": data = request.json notes.append(data) return jsonify({"status":"ok"}), 201 return jsonify(notes) if __name__ == "__main__": app.run(debug=True)


Instructions: Expand to SQLite (SQLAlchemy), add templates or a minimal front-end, add auth if needed, and write tests and README.


Sample Daily Schedule (for 2 hours/day)

  • 20 min: Quick review of yesterday’s notes and code.

  • 60 min: Work through the day’s topic and exercises.

  • 20 min: Improve yesterday’s project, write one unit test, or refactor.

  • 20 min: Log what you learned and plan tomorrow’s small goal.

Study Habits That Accelerate Learning

  • Code every day. Small, consistent practice beats occasional long sessions.

  • Build real projects — they push you to glue topics together.

  • Teach what you learn — blog posts or short videos lock knowledge in.

  • Read other people’s code — learn idioms and patterns.

  • Use version control from day one — commit often and write clear messages.

Project Ideas (portfolio-ready)

  • CLI to-do manager that persists to JSON or SQLite.

  • Expense tracker with CSV import/export and visualization.

  • Simple Flask notes site with CRUD and basic authentication.

  • Headline scraper that emails a daily digest.

  • File utilities: batch rename, image resize pipeline, or metadata extractor.

Common Pitfalls & How to Avoid Them

  • Copy-paste learning: Type code, change it, and experiment.

  • Skipping fundamentals: Poor foundations slow later progress.

  • No tests: Even a few small tests prevent regressions and build confidence.

  • Perfection paralysis: Deliver a working version first; iterate later.

Resources (practical shortlist)

  • Official Python docs — primary reference.

  • Books: “Automate the Boring Stuff with Python”, “Python Crash Course”.

  • Interactive platforms: freeCodeCamp, Codecademy, Exercism.

  • Community: Stack Overflow, Reddit r/learnpython, and local meetups.

  • Libraries to explore: requests, BeautifulSoup, pandas, matplotlib, Flask, pytest.

How to Measure Progress After 30 Days

  • Can you build and explain a small project end-to-end?

  • Are your projects in GitHub with README and basic tests?

  • Can you read and modify someone else’s code?

  • Do you write or run simple unit tests?
    If “yes” to most, you’ve built a solid, practical foundation.

  • Conclusion
    Thirty days won’t make you a master, but with daily focus and the right projects you’ll gain a portfolio-ready foundation: automation scripts, small web apps, or data analyses. Use this plan as a scaffold: adapt pace to your schedule, deepen topics that interest you, and keep building. Python rewards curiosity, consistency, and real-world practice.

    Frequently Asked Questions (short answers)
    Q: Is 30 days enough to get a job?
    A: No — it’s enough for a foundation and starter projects. Jobs usually require deeper, domain-specific projects, interview prep, and more experience.

    Q: How many hours per day?
    A: 1–2 hours/day is realistic; 3–4 accelerates progress.

    Q: Which Python version?
    A: Use the latest stable Python 3.x.

    Q: Do I need advanced math?
    A: No for general programming. For data science, learn statistics and linear algebra later.

    Q: When to learn frameworks?
    A: After you’re comfortable with basics. Frameworks are easier to learn with a solid core.

    Q: What if I miss days?
    A: Don’t stress — pick up where you left off. Consistency matters more than perfection.

    Final note from the author
    This plan comes from years of helping learners go from curiosity to usable skill. If you’d like, I’ll:

    • tailor the schedule to your exact daily hours,

    • create ready-to-run code snippets as a downloadable ZIP, or

    • convert the plan into a printable 30-day checklist you can tick off daily.