You don't need to be an expert to make Python do real work for you. Here are 5 short scripts I use to show beginners how automation feels. Every one of them was tested with Python 3.12 and uses only the standard library, so there is nothing to install.
1. Sort a messy folder by file type
import shutil
from pathlib import Path
folder = Path("Downloads")
for f in folder.iterdir():
if f.is_file():
ext = f.suffix[1:].lower() or "other"
(folder / ext).mkdir(exist_ok=True)
shutil.move(str(f), folder / ext / f.name)
Your PDFs go into pdf/, photos into jpg/, and so on. Run it once and your Downloads folder is clean.
2. Rename hundreds of photos in one go
from pathlib import Path
folder = Path("photos")
for i, f in enumerate(sorted(folder.glob("*.jpg")), 1):
f.rename(folder / f"photo_{i:03}.jpg")
Output: photo_001.jpg, photo_002.jpg, ... The :03 pads numbers with zeros so they stay in order.
3. Add up a sales CSV
import csv
total = 0
with open("sales.csv", newline="") as fh:
for row in csv.DictReader(fh):
total += float(row["price"]) * int(row["qty"])
print(f"Total sales: {total:.2f}")
With a file containing pen (20 x 3), book (150 x 2) and bag (900 x 1), it prints Total sales: 1260.00. This is exactly the kind of job small businesses pay freelancers to automate.
4. Find the most common words in a text
from collections import Counter
text = "Python makes boring tasks easy. Python is fun and Python is free."
words = [w.strip(".,").lower() for w in text.split()]
print(Counter(words).most_common(3))
Output: [('python', 3), ('is', 2), ('makes', 1)]
5. Generate a strong password
import secrets, string
chars = string.ascii_letters + string.digits + "!@#$"
print("".join(secrets.choice(chars) for _ in range(12)))
Use secrets, not random, for anything security related. secrets is designed for it.
What to do next
Pick one script, change one thing (a folder name, a column, the password length) and run it again. That small habit of tweaking working code is how beginners turn into developers.
If you want 60 more tested programs like these, with real outputs, solved exercises, a practice test and a bonus AI automation chapter, I put them together in my book Python Programming for Beginners: https://farhanbreeze4.gumroad.com/l/ugosjh
Which boring task would you automate first? Tell me in the comments.
Top comments (0)