
How to Learn Python in 30 Days — A Beginner Roadmap You Can Actually Code Along With
Most Python roadmaps repeat the same list of topics without ever showing real code. This one is different: every week below includes code you can type and run, plus a day-by-day table that says exactly what to learn and what to practice, from Day 1 to Day 30.
This plan is for someone who has never written a program before, or who tried once and stalled. It assumes 30-60 minutes a day, most days, and a computer that can either install Python or open a browser. By Day 30 you'll have three small working projects and a solid grip on the fundamentals — not a job offer, and not expert-level skill. Thirty days builds a foundation; what you do with it after that is covered near the end of this article.
What You Need Before Day 1
- Any computer that can run a browser, or a free code editor like VS Code
- Python installed from python.org (free), or a browser-based option like Replit, which lets you write and run Python without installing anything if you'd rather skip setup on day one
- 30-60 minutes a day, most days
If your laptop is old or slow, use a browser-based option for the first week or two. Install a full local setup once the basics feel familiar, not before.
Week 1 — Core Syntax (Days 1-8)
Week 1 covers the building blocks every program uses: storing values, making decisions, and repeating steps. Nothing here needs a function or a class yet — just variables, conditions, and loops. Here's what that looks like combined into one small program:
total = 0
count = 1
while count <= 5:
price = count * 100
total += price
print("Item", count, "costs", price)
count += 1
print("Total:", total)
Run that and you'll see five lines counting up to "Item 5 costs 500," followed by "Total: 1500." Type it yourself rather than copy-pasting — the colons and indentation are the syntax Week 1 is meant to build muscle memory for.
| Day | Learn | Practice |
|---|---|---|
| Day 1 | Install Python and run your first program | Print your name and a short greeting |
| Day 2 | Variables and basic data types (text, numbers, true/false) | Store your name, age, and city in variables and print them together |
| Day 3 | Getting input from the user with input() | Ask for two numbers and print their sum |
| Day 4 | Arithmetic operators (+ - * /) | Build a bill calculator that adds item prices plus a fixed tax |
| Day 5 | if/elif/else and comparison operators | Build an age checker: minor, can vote, or can drive |
| Day 6 | Logical operators (and, or, not) | Build a simple login check for a username and password |
| Day 7 | for loops and range() | Print a multiplication table for a number the user enters |
| Day 8 | while loops and loop control (break, continue) | Build a number-guessing game |
Week 2 — Data Structures and Functions (Days 9-14)
Week 2 introduces the containers that hold real data (lists, dictionaries, tuples) and functions, which package logic once so you can reuse it. Functions land here rather than Day 1 on purpose — they make more sense once you've written enough repetitive code by hand to feel why reuse matters:
def classify_temp(celsius):
if celsius >= 35:
return "hot"
elif celsius >= 20:
return "pleasant"
else:
return "cold"
readings = {"Mon": 38, "Tue": 22, "Wed": 15}
for day, temp in readings.items():
print(day, "->", classify_temp(temp))
That prints Mon -> hot, Tue -> pleasant, Wed -> cold. The function itself doesn't print anything; it returns a value, and the loop decides what to do with it — that separation is the point of Days 13-14.
| Day | Learn | Practice |
|---|---|---|
| Day 9 | Lists — creating, indexing, looping | Store a shopping list and print each item with its position |
| Day 10 | List methods (append, remove, sort) | Build a to-do list that can add and remove items in one run |
| Day 11 | Dictionaries — key-value pairs | Build a contact book of names and phone numbers |
| Day 12 | Tuples, and when to use one instead of a list | Store a fixed set of coordinates or RGB colour values |
| Day 13 | Defining and calling functions | Turn your Day 4 bill calculator into a reusable function |
| Day 14 | Parameters, return values, default arguments | Write a function that classifies a temperature as hot, pleasant, or cold |
Week 3 — Files, Errors, Classes, and Your First API Call (Days 15-21)
Week 3 moves past self-contained exercises into the outside world: real files, code that can fail, and data from the internet. Here's a to-do app that saves itself to a file, tying together a class, file handling, and error handling:
class Task:
def __init__(self, text, done=False):
self.text = text
self.done = done
def __str__(self):
mark = "x" if self.done else " "
return f"[{mark}] {self.text}"
def save_tasks(tasks, filename="tasks.txt"):
with open(filename, "w") as f:
for t in tasks:
f.write(f"{t.done},{t.text}\n")
def load_tasks(filename="tasks.txt"):
tasks = []
try:
with open(filename) as f:
for line in f:
done, text = line.strip().split(",", 1)
tasks.append(Task(text, done == "True"))
except FileNotFoundError:
pass
return tasks
my_tasks = [Task("Learn file handling"), Task("Learn classes", done=True)]
save_tasks(my_tasks)
for t in load_tasks():
print(t)
That prints [ ] Learn file handling and [x] Learn classes. The try/except around the file read exists because tasks.txt doesn't exist the very first time this runs — without it, the program would crash before it ever got the chance to create the file.
Day 20 introduces APIs. An API is a way for one program to ask another for data over the internet, usually handed back as JSON — text formatted so it's easy to read, and structured almost exactly like a Python dictionary. requests sends the request; .json() turns the response into a dictionary you can use directly:
import requests
response = requests.get("https://api.github.com/users/octocat")
data = response.json()
print(data["name"], "-", data["public_repos"], "public repos")
That calls GitHub's public API and prints back a name and repo count.
| Day | Learn | Practice |
|---|---|---|
| Day 15 | String methods and f-string formatting | Format and print a simple receipt |
| Day 16 | Reading files with open() | Read a text file and count how many lines it has |
| Day 17 | Writing and appending to files | Save your Day 10 to-do list to a file so it isn't lost when the program closes |
| Day 18 | Handling errors with try/except | Make your Day 16 file reader not crash when the file doesn't exist |
| Day 19 | Installing packages with pip, importing modules | Install requests and print its version number |
| Day 20 | What an API is; reading JSON with requests | Fetch data from a public API and print two fields from the response |
| Day 21 | Classes and objects — grouping data and behaviour together | Turn your Day 17 to-do list into a Task class |
Week 4 — Shortcuts, Real Data, and Three Projects (Days 22-30)
Week 4 adds tools that make Python noticeably more useful: comprehensions as a shortcut for loops you already know, pandas and matplotlib for data, and enough regular expressions and web scraping to pull information out of text and pages. Each shows up only after the plain version already makes sense — a shortcut only helps once you understand what it's shortcutting.
A list comprehension does in one line what a loop-plus-if otherwise takes four lines to do. pandas does something similar for tables of data, describing what you want instead of looping through rows by hand:
readings = {"Mon": 38, "Tue": 22, "Wed": 15}
hot_days = [day for day, temp in readings.items() if temp >= 35]
print(hot_days) # ['Mon']
import pandas as pd
data = {"day": ["Mon", "Tue", "Wed"], "expense": [200, 450, 120]}
df = pd.DataFrame(data)
print(df["expense"].sum()) # 770
The same data can become a chart in three lines with matplotlib, saved to a file rather than shown on screen:
import matplotlib.pyplot as plt
plt.bar(data["day"], data["expense"])
plt.title("Daily Expenses")
plt.savefig("expenses.png")
For pulling a specific pattern out of plain text, like an email address, regular expressions are the tool. For pulling data out of a webpage's HTML, BeautifulSoup does the same kind of job — shown here on a plain HTML string rather than a live site so it's something you can run instantly:
import re
text = "Contact us at support@example.com for help."
match = re.search(r"[\w.+-]+@[\w-]+\.[\w.-]+", text)
print(match.group()) # support@example.com
from bs4 import BeautifulSoup
html = "<html><head><title>Example Page</title></head></html>"
soup = BeautifulSoup(html, "html.parser")
print(soup.title.string) # Example Page
Once this makes sense, pointing requests.get() at a real page and feeding the result into BeautifulSoup works the same way.
| Day | Learn | Practice |
|---|---|---|
| Day 22 | List comprehensions and lambda functions | Rewrite one earlier loop as a one-line list comprehension |
| Day 23 | pandas basics — loading data into a table | Load a small list of daily expenses into a DataFrame and print the total |
| Day 24 | A first chart with matplotlib | Plot your Day 23 expense data as a bar chart |
| Day 25 | Regular expressions basics | Pull an email address out of a block of text |
| Day 26 | Web scraping basics with BeautifulSoup | Parse a page's title out of its HTML |
| Day 27 | Project 1 — Expense Tracker | Build the minimum version: add an expense, store its category, calculate a total |
| Day 28 | Project 2 — Weather Lookup | Fetch and print today's weather for a city you choose |
| Day 29 | Project 3 — Simple Web Scraper | Pull headlines or listings from one real page |
| Day 30 | Using Git and pushing to GitHub | Create a free GitHub account and push all three projects |
The three projects, in more detail
Expense Tracker. Minimum: add an expense with an amount and category, and calculate a running total. Optional: save it to a file (Day 17), show totals by category, add a monthly summary.
Weather Lookup. Minimum: ask for a city, call a weather API, print the current temperature and conditions, using the requests pattern from Day 20. OpenWeatherMap has a commonly used free tier for current weather — check its current pricing page before you build, since free-tier terms change. Optional: a short forecast instead of just today; check more than one city per run.
Simple Web Scraper. Minimum: pull the title and one heading from a single page, using the Day 26 pattern. Optional: loop over a short list of pages instead of one; save results to a file; use try/except so one failed page doesn't crash the script.
If You Already Know Java, Here's the Fast Lane
Coming from Java, most of Python's syntax isn't new logic, just less of it on the page:
| Task | Java | Python |
|---|---|---|
| Printing | System.out.println("Hi"); | print("Hi") |
| Variables | int x = 5; | x = 5 |
| Conditions | if (x > 5) { } | if x > 5: |
| Loops | for (int i = 0; i < 5; i++) { } | for i in range(5): |
| Functions | public int add(int a, int b) { return a + b; } | def add(a, b): return a + b |
| Lists/arrays | int[] nums = {1, 2, 3}; | nums = [1, 2, 3] |
| Dictionaries/maps | Map<String, Integer> m = new HashMap<>(); | m = {} |
| Classes | public class Task { } | class Task: |
| Block syntax | Curly braces | Indentation, no braces |
What trips up Java developers is usually trusting indentation to define a block instead of curly braces, not the syntax itself. Get that sorted in Week 1 and the rest of this roadmap moves faster than it would starting from nothing.
What to Learn After These 30 Days
Thirty days builds a foundation, not expertise, and not a job on its own. What comes next depends on which direction interests you:
Python for Web Development
HTTP basics, how APIs are built (not just called), a framework like FastAPI or Django, databases, authentication.
Python for Data Analysis
NumPy and pandas in depth, matplotlib properly, cleaning messy real-world data, enough SQL to pull data from a database.
Python for Automation
Build on the file-handling and API skills from Weeks 2-3, learn more automation-focused libraries, and write scripts that run on a schedule instead of manually.
Python for AI and Machine Learning
NumPy, pandas, and basic statistics first, then scikit-learn and the fundamentals of how machine learning models work.
Python for Coding Interviews
Core data structures and algorithms, problem-solving under time pressure, and reasoning about time and space complexity.
Pick one direction rather than all five at once — the fundamentals here transfer to any of them, but studying every path at once is a slower way to make progress in any of them.
Common Problems Beginners Run Into
- "python is not recognized." Python isn't installed or your terminal can't find it. Reinstall from python.org with "Add Python to PATH" checked, or try
python3instead ofpython. - IndentationError. Usually a missing indent after a colon, or mixed tabs and spaces. Stick to spaces and keep them consistent.
- SyntaxError. Almost always a missing colon, an unmatched bracket or quote, or a typo — the line number in the error message points close to where Python got confused.
- ModuleNotFoundError. The package isn't installed. Run
pip install package-namein your terminal, not inside the file itself. - FileNotFoundError. The path is wrong, or the file lives in a different folder than the script. Run from the same folder, or use the full path.
- Code runs but does something unexpected. A variable likely changed somewhere, or a line landed in the wrong indented block. Add a
print()before the confusing line to check what a variable holds.
Mistakes That Slow Beginners Down
- Watching tutorial videos without opening an editor and typing along
- Memorizing syntax instead of running code and reading the error messages it produces
- Jumping to a framework like Django before loops and functions feel automatic
- Skipping projects entirely and only ever working inside tutorials
What to Do When You Fall Behind or Hit the Day 10 Wall
Missing a day or two isn't a reason to restart from Day 1 — pick up where you left off. Some beginners hit a wall around Day 10 to 12, right as functions and data structures combine into slightly more complex logic and the early "I understand everything" feeling wears off. That's normal, not a sign you're bad at this; slowing down for a day beats pushing through confused.
The 30-day structure is also just a pace, not a rule. Some people finish the equivalent in three weeks, others take two months, and both are fine — adjust it to a schedule you can actually sustain past Week 1.
Free Resources Worth Your Time
- The official Python tutorial at python.org — free, no account needed
- freeCodeCamp's Python course videos on YouTube, which cover the basics through object-oriented programming at no cost
- Automate the Boring Stuff with Python — free to read online under a Creative Commons license, especially useful once you reach Week 3 and 4
- LeetCode's free tier for practicing the logic from Weeks 1-2 once you've learned it; a paid Premium tier adds extras you don't need as a beginner
Start Day 1 Now
The beginners who tend to pick up Python fastest aren't always the ones who finish a course start to finish — often it's the ones who get stuck on a real script early and fix it themselves. Don't spend another hour looking for the perfect course. Open your editor, type the Week 1 example above, change the numbers, and run it. That's Day 1.
Frequently Asked Questions
Was this article helpful?
Written by
Muthu
I'm Muthu, a software engineer based in India who writes about technology, career growth, and personal finance on the side. I started Techpulzo because most content in these spaces online is either too shallow to be useful or too jargon-heavy to actually help you decide anything — so every article here starts from a real question I'd want answered myself, and tries to show the actual numbers and trade-offs instead of surface-level advice.
Comments
No comments yet. Be the first to share your thoughts!