Sign up for your FREE personalized newsletter featuring insights, trends, and news for America's Active Baby Boomers

Newsletter
New

Learning Python By Teaching Your Computer To Be Petty And Petty Good At It

Today’s Deal: Download 7,000+ GitHub Projects from HN — LLMs, SaaS, OpenSource Tools, and more...

  • ???? Instant download. One-time price (less than a single coffee).

We all learn Python by printing “Hello, World!”
But today, let’s learn Python by teaching your computer to hold a grudge.

That’s right — we’re going to write a Python program that:

  • Tracks every time you run a certain program (e.g., Slack, YouTube, Steam…)
  • Keeps score
  • Shames you (gently) if you’re overdoing it

Why?
Because if you want to learn how to build real-world Python scripts, nothing’s more fun than coding something slightly ridiculous but surprisingly useful.

???? Why This Works

This mini-project teaches you:

  • File handling (to track usage)
  • Scheduling tasks with Python
  • Conditional logic
  • Fun with notifications and alerts
  • And how to prank yourself in a productive way

We’ll even make it extensible — you can track any app or any behavior later.

????️ Step 1: Let’s Track Something You’re Guilty Of

Let’s say we want to track when Slack is running.

Here’s a little script that checks if a program is active:

import psutil 
 
def is_running(process_name): 
    for proc in psutil.process_iter(['name']): 
        if process_name.lower() in proc.info['name'].lower(): 
            return True 
    return False 

psutil is like giving Python X-ray vision into your system. You’ll need to install it:

pip install psutil 

???? Step 2: Count the Offenses

Let’s store the count in a JSON file so it persists:

import json 
import os 
 
def load_data(filepath): 
    if not os.path.exists(filepath): 
        return {} 
    with open(filepath, 'r') as f: 
        return json.load(f) 
 
def save_data(filepath, data): 
    with open(filepath, 'w') as f: 
        json.dump(data, f) 

Use this like so:

data = load_data('guilt.json') 
data['slack'] = data.get('slack', 0) + 1 
save_data('guilt.json', data) 

Every time Slack is found running, it adds one to the count.

???? Step 3: Add a Little Sass

We want the script to say something spicy when you're overdoing it:

import random 
 
def judge_you(app, count): 
    if count > 10: 
        print(random.choice([ 
            f"Slack again? That's {count} times today. Everything okay?", 
            f"You and {app} need to take a break.", 
            f"Intervention time. Step away from the screen." 
        ])) 

You can expand this with system notifications using plyer, notifiers, or native macOS/Linux tools.

⏲️ Step 4: Schedule It to Run Automatically

You can use schedule in Python:

import schedule 
import time 
 
def check_slack(): 
    if is_running("slack"): 
        data = load_data('guilt.json') 
        data['slack'] = data.get('slack', 0) + 1 
        save_data('guilt.json', data) 
        judge_you("Slack", data['slack']) 
 
schedule.every(10).minutes.do(check_slack) 
 
while True: 
    schedule.run_pending() 
    time.sleep(1) 

This will check every 10 minutes and build up the “guilt count.”

???? The Bigger Lesson Here

What did we really learn?

  • You can track app usage with Python
  • You can create persistent counters
  • You can wrap it in humor to learn faster and remember more

This is how I personally actually learned Python — by building weird little projects that solved real problems in funny ways.

And if this kind of project speaks to you, I found inspiration from:

I keep python.0x3d.site bookmarked. It’s like a cheat sheet and inspiration board in one.

???? Want More Like This?

  • Add more apps to track
  • Set daily “guilt” limits and alert when you cross them
  • Build a silly dashboard with emojis and trends
  • Tweet your own usage reports using Python + Twitter API

You’re only limited by how petty your computer can be ????

So the next time someone tells you to "build a productivity tool," maybe build one that lightly bullies you into being productive.

Keep learning weird,
Keep coding Python.

???? Featured Product: Ultimate Business Starter Bundle

Kickstart your next business venture with this exclusive bundle of 5+ premium products — everything you need to launch successfully.

???? Limited-Time Deal:
Enjoy an insane 5000%+ value boost — only available for the first 20 sales!

???? Build, Rank & Package: Start a Local Website Business for $0 - Only 20 Left!

What if you could launch a revenue machine for local businesses this weekend — and get paid $1K/month doing it?This is not a course. This is not some fluffy side hustle idea.This is a system — engineered to help you build, rank, and monetize local business websites in record time.Introducing The Local Business Launch System — a rapid-deployment toolkit to help freelancers, coders, and solo hustlers dominate the local services market.Here's what's inside:???? Build a Hyper-Simple Website for a Local BusinessLaunch a clean, fast, mobile-friendly site in a day. No fluff. Just results.???? $1000+ Page Plan: Rank a Simple Website for Local KeywordsSEO isn't dead. Bad SEO is. Learn how to rank for the only keywords that matter—local ones.???? Local Biz Toolkit: Make $1K/Month Selling a “Business Starter Pack”Don’t just sell a site. Sell the transformation — logo, content, setup, everything they need.Why this works:Offline businesses don’t need fancy tech.They need one person who can get them online, visible, and looking legit. That person is you. This bundle gives you the website, the ranking strategy, and the starter pack to offer a complete package clients will happily pay for.No ads. No audience. No budget.Just one weekend and this system.If I had to start a service business from scratch with zero cash?This is what I’d use.Let’s build something real.Let’s turn your laptop into a local business launcher.

0x7bshop.gumroad.com


Recent