You did it ๐
You now know enough Python to start writing useful little programs. Here's a roadmap for what to learn next, and some places to practise.
What to learn next (in roughly this order)
- Error handling โ
try/exceptblocks for when things go wrong (e.g. user types text instead of a number). - File I/O โ reading and writing text files with
open(). - Modules &
importโ using Python's standard library (math,datetime,random,json) and splitting your own code into multiple files. - Virtual environments &
pipโ installing third-party packages from PyPI. - Classes / OOP โ defining your own object types with
class. - A real-world library โ pick one based on what excites you:
- Data & analysis:
pandas,matplotlib - Web apps:
FastAPIorFlask - Automation / scripting:
requests,beautifulsoup4 - Games / graphics:
pygame
- Data & analysis:
Free places to practise
- The official Python tutorial โ surprisingly readable.
- Exercism โ Python track โ small exercises with mentor feedback.
- Codewars โ bite-sized "katas" sorted by difficulty.
- Real Python โ high-quality tutorials and articles.
- Automate the Boring Stuff with Python โ free online book, very practical.
Project ideas to lock it in
Theory only sticks once you build something. Try one of these โ small enough to finish in an afternoon, but real enough to teach you something:
- A command-line to-do list that saves to a text file.
- A tip calculator that asks for the bill and party size.
- A password generator with options for length and symbols.
- A script that renames every file in a folder based on a pattern.
- A quiz game that reads questions from a file and keeps score.
The single most useful habit
Don't read more before you've coded a bit. Pick one tiny project and finish it. You'll learn
more from one finished thing than from ten tutorials.
Quick reference
# Variables and types
name = "Sam"; age = 34; pi = 3.14; ok = True
# Input / output
who = input("Name? ")
print(f"Hi {who}")
# Conditionals
if age >= 18:
print("adult")
else:
print("minor")
# Loops
for i in range(3):
print(i)
# List + dict
nums = [1, 2, 3]
person = {"name": "Sam", "age": 34}
# Function
def add(a, b):
return a + b