577
you are viewing a single comment's thread
view the rest of the comments
[-] mdhughes@lemmy.sdf.org 39 points 5 days ago

print( ["even", "odd"][num % 2] )

If you need to avoid evaluating the wrong branch:

print( [lambda: "even", lambda: "odd"][num % 2]() )

this post was submitted on 12 Jun 2025
577 points (98.7% liked)

Programmer Humor

24240 readers
828 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS