Up Next: Where Python Goes Next
Look back at what Module 5 taught, sorting and moving files, command-line options, running on a schedule and fetching live data with a saved copy, try a weekly report of your own that uses all of it, and see the three directions Module 6 lets you try, data analysis, machine learning and building web APIs.
Journeyman · Python · Updated
After this lesson you can
- Describe the three directions Python goes after the basics, data analysis, machine learning and building web APIs, and what each one is for
Key takeaways
- After Module 5 you can sort, copy and move files safely, turn a script into a tool with options, run it on a schedule, and fetch live data from a web API with a saved copy for bad days.
- A weekly report built from a CSV file and a live forecast puts every one of those tools to work.
- Python goes three main ways from here. Data analysis turns tables into answers and charts, and machine learning makes programs that learn from examples.
- Building web APIs is the third way, the other side of this chapter, a server of your own that answers other programs with JSON.
When this module started, your programs worked on what you typed into them. Now they reach out: they tidy a folder of real files, take options like the tools you install, run on their own every Monday, and bring in live data from the internet without falling over when the internet isn't there. That's the work Python does most outside a classroom: saving people time.
This lesson looks back at what you can do, gives you a project to try with all of it, and shows what Module 6 lets you try next.
What you can do now
After Module 5, you can:
- find your way around folders with
pathlib: join paths with/, read a file's name and extension, list and find files, make folders; - copy, move and rename files safely, with a dry run that shows what would happen first;
- turn a script into a tool with
argparse: arguments, options, flags and a free--help; - run a script on a schedule, with Task Scheduler on Windows or cron on a Mac, and keep a log of what it did;
- call a web API with requests: a URL, a
User-Agentheader, a timeout, the status code and the JSON; - handle a failed request with
raise_for_status(), a friendly message and one more try; - keep a saved copy of each answer with its date, fall back to it, and test it all with a stand-in fetch.
Here's a short program that uses a few of those, on the camping trip's saved forecast:
import json
from pathlib import Path
trip = Path("pine-ridge")
trip.mkdir(exist_ok=True)
copy = trip / "forecast-copy.json"
with open(copy, "w", encoding="utf-8") as file:
json.dump({"saved_on": "2026-11-17", "forecast": {"Saturday": 43, "Saturday Night": 38, "Sunday": 45}}, file)
with open(copy, encoding="utf-8") as file:
saved = json.load(file)
cold = [name for name, degrees in saved["forecast"].items() if degrees < 40]
print("In", trip.name + ":", [path.name for path in trip.iterdir()])
print("Saved on", saved["saved_on"], "- below 40°F:", cold)
In pine-ridge: ['forecast-copy.json']
Saved on 2026-11-17 - below 40°F: ['Saturday Night']
A folder made with pathlib, a path joined with /, a saved copy with its date, and a comprehension to read it: you can read every line.
Try it: a weekly report of your own
The best way to find out how much you can do is to build something with no step-by-step instructions. Try a weekly report for a community garden club, with only what you know now:
- The data: a CSV file of the week's watering log, one row per watering: the date, the garden bed, who watered it and how many gallons. Make up a week of it for five or six beds.
- The forecast: the National Weather Service's forecast for the garden's spot (any place in the US; pick your own latitude and longitude), with the rain expected in the days ahead.
- Which beds are due: a bed that hasn't been watered in three days is due, unless rain is likely tomorrow.
- Options:
--weekfor which week's log to read,--outputfor where to write the report, and--offlineto use the saved forecast. - A saved copy: the forecast saved with its date, and used when the network is down.
- The report: written to a Markdown file, with a heading, the forecast, the beds that are due, and who watered the most.
- Every Monday: set it to run on a schedule, with its own
pythonfrom the project's virtual environment.
Write one function at a time, and test the ones that don't need the network with a stand-in fetch. There's no test suite for this one: when the report says what you worked out by hand, it works.
What Module 6 lets you try
Python goes several ways from here, and Module 6 lets you try them, an hour each, before you choose one:
- Data analysis: with pandas, the package analysts use, read a coffee shop's sales into a table, sum and sort it in a line or two, and draw your first chart.
- Machine learning: with scikit-learn, make a program that learns from a lemonade stand's past days to guess tomorrow's sales, and find out how to tell when its guess is wrong. Machine learning is teaching a program from examples instead of writing every rule by hand.
- Building web APIs: with FastAPI, build the other side of this chapter, your own web API that answers a book club's requests with JSON, and test it the way you tested your forecast.
Each taste ends by naming the course that goes further. The module closes with Where to Go Next: a look back at the whole course, and how to choose what to learn after it.
Check yourself
2 questions to try on the lesson page.
So what
Module 5 put Python to work saving you time. Module 6 lets you try the three directions it can take you next, so the one you choose is one you've already tried.