IOPCC

A 2nd IOPCC Winner

Author:

Judges' Comments

Uses a unique type of trick that is already broken by changes in Python 3.14.

Author's Comments

Program name: underscore-support

What it is:

This program calculates e, but that's not why it's important. In the 
workplace, speed is important, and sometimes you simply can't wait for a 
new keyboard toarrive. Halfway through writing your program and your 
spacebar breaks? You'llhave to find a way to write that for-loop without 
spaces!

Stepping out of character, this program is like Inspector Clouseau. It does 
exactly what it says it's going to do, even though it really should fail.

What it needs:

Tested with Python 3.11 on Windows 11. 
No external libraries required, since the math module is built-in. 
Nothing else fancy --> just run it!

Why it's cool:

 - One line of garbage that makes colons act like equals-signs      (ln 17)
 - A variable that wants to be a loop when it grows up              (ln 22)
 - An equals-sign that doesn't do what it's told                    (ln 23)
 - A semicolon that doesn't want 'print' and 'e' to get together    (ln 25)
 - Someone's cat stepped on the right side of the program        (ln 20-25)
 - Calculates e in a completely different way than what it appears to do

How it does it (Spoliers):

Line 17 reassigns the dictionary that holds variable annotations to be a 
pointer to globals(). This means that when you annotate a variable like so,

    variable: int

Python does globals()['variable'] = int, creating a new variable instead of
just declaring a type hint. This, combined with deceptive use of ; and \ 
characters, creates the very odd-looking syntax you see in the script.

From there, we just use the mess of characters at the end of each of the 
lines to set up for a calculation of e using the limit formula. (Not the 
infinite sum!)