Hello! Welcome to the interactive version of "What the f*ck Python?". The intent of this site is to make it easier to navigate around the project and provide functionality to execute the snippets in the same browser. If you find any issues feel free to report them at the upstream wtfpython repository. This is an experimental project built by our summer interns, we're happy to improvise on it based on your feedback, but please don't be too harsh in your feedback :)

PS: This project relies on pyiodide for the Python interpreter, really appreciate the work pyiodide team has put in!
HELP
SHOW
TERMINAL
FULL SCREEN TERMINAL
SHOW/HIDE TERMINAL

Table of Contents

Structure of the Examples
Usage
Examples
Strain your brain!
First things first! * Strings can be tricky sometimes Be careful with chained operations How not to use is operator Hash brownies Deep down, we're all the same. Disorder within order * Keep trying... * For what? Evaluation time discrepancy is not ... is not is (not ...) A tic-tac-toe where X wins in the first attempt! Schrödinger's variable The chicken-egg problem * Subclass relationships Methods equality and identity All-true-ation * The surprising comma Strings and the backslashes not knot! Half triple-quoted strings What's wrong with booleans? Class attributes and instance attributes yielding None Yielding from... return! * Nan-reflexivity * Mutating the immutable! The disappearing variable from outer scope The mysterious key type conversion Let's see if you can guess this?
Slippery Slopes
Modifying a dictionary while iterating over it Stubborn del operation The out of scope variable Deleting a list item while iterating Lossy zip of iterators * Loop variables leaking out! Beware of default mutable arguments! Catching the Exceptions Same operands, different story! Name resolution ignoring class scope Rounding like a banker * Needles in a Haystack * Splitsies * Wild imports * All sorted? * Midnight time doesn't exist?
The Hidden treasures!
Okay Python, Can you make me fly? goto, but why? Brace yourself! Let's meet Friendly Language Uncle For Life Even Python understands that love is complicated Yes, it exists! Ellipsis * Inpinity Let's mangle
Appearances are deceptive!
Skipping lines? Teleportation Well, something is fishy...
Miscellaneous
+= is faster Let's make a giant string! Slowing down dict lookups * Bloating instance dicts Minor Ones *
Contributing
Acknowledgements
🎓 License
Surprise your friends as well!
Need a pdf version?
Built by team at 🚀 f5 labs