Last active
September 19, 2025 18:50
-
-
Save Urpagin/904c39b0a4cc914f92592e338e3381a0 to your computer and use it in GitHub Desktop.
Funny One-liner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Author: Urpagin | |
| # Date: 2025-09-19 | |
| # Description: Counts and prints the number of draws needed to obtain an even number. | |
| # Numbers randomly selected between 1 and 6 (inclusive). | |
| # License: MIT | |
| print(f"{(rnd := __import__('random')) and ''}{((END := [0]), '')[1]}{(nums := len([n for n in iter(lambda: (lambda r: r if r % 2 != 0 else (END.__setitem__(0, r)) or END)(rnd.randint(1, 6)), END)]) + 1) and ''}There {'have' if nums > 1 else 'has'} been {nums} draw{'s' if nums > 1 else ''} before getting an even number: {END[0]}.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment