gitwtfhub

wtf is 30-seconds-of-python?

chalarangelo/30-seconds-of-python — explained in plain English

Analysis updated 2026-06-24

8,831PythonAudience · developerComplexity · 1/5LicenseSetup · easy

TL;DR

A retired collection of short, practical Python code snippets for common programming tasks, now merged into the 30-seconds-of-code project, all content is still browsable at 30secondsofcode.org.

Mindmap

mindmap
  root((30s of Python))
    What it is
      Short code snippets
      Common tasks
      Explained examples
    Status
      Archived May 2023
      Merged into 30soc
    Topics
      Strings and lists
      Dicts and functions
    License
      CC-BY-4.0
      Free with credit
    Audience
      Beginner coders
      Python learners

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Look up a tested Python snippet for a common task like flattening a list or chunking an array.

REASON 2

Copy a short code example directly into a project without writing it from scratch.

REASON 3

Browse Python patterns organized by topic to learn common approaches used in everyday code.

What's in the stack?

Python

How it stacks up

chalarangelo/30-seconds-of-pythonashawkey/stable-dreamfusiongarrettj403/scienceplots
Stars8,8318,8308,832
LanguagePythonPythonPython
Setup difficultyeasyhardmoderate
Complexity1/55/52/5
Audiencedeveloperresearcherresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min
Use and share freely with attribution, the CC-BY-4.0 license allows any use including commercial as long as you credit the source.

Wtf does this do

This repository was a collection of short, practical Python code snippets covering common programming tasks. Each snippet was designed to be small enough to read and understand quickly, with an explanation and examples alongside the code. As of May 2023, this repository and others in the 30-seconds family were merged into a single unified repository called 30-seconds-of-code. New activity, contributions, and updates happen there rather than here. The snippet content itself is still accessible on the project website at 30secondsofcode.org, where you can browse the Python collection, search by name or topic, and copy code directly from the page. The snippets are licensed under CC-BY-4.0, meaning they can be reused freely with attribution. This is a learning and reference resource aimed at developers who want quick examples for everyday Python tasks, not a library you install or a framework you build on.

Yoink these prompts

Prompt 1
Give me 5 short Python utility functions for working with dictionaries, each under 10 lines, in the style of 30-seconds-of-python.
Prompt 2
Write a Python one-liner for flattening a nested list and explain how it works.
Prompt 3
Show me a Python snippet that chunks a list into groups of N items with a clear step-by-step explanation.
Prompt 4
What are the most useful Python string manipulation snippets a beginner should memorize for everyday scripting?

Frequently asked questions

wtf is 30-seconds-of-python?

A retired collection of short, practical Python code snippets for common programming tasks, now merged into the 30-seconds-of-code project, all content is still browsable at 30secondsofcode.org.

What language is 30-seconds-of-python written in?

Mainly Python. The stack also includes Python.

What license does 30-seconds-of-python use?

Use and share freely with attribution, the CC-BY-4.0 license allows any use including commercial as long as you credit the source.

How hard is 30-seconds-of-python to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is 30-seconds-of-python for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.