minus-squareDigital Mark@lemmy.sdf.orgtoProgrammer Humor@programming.dev•Modern ProgramminglinkfedilinkEnglisharrow-up43arrow-down1·16 days agoprint( ["even", "odd"][num % 2] ) If you need to avoid evaluating the wrong branch: print( [lambda: "even", lambda: "odd"][num % 2]() ) linkfedilink
minus-squareDigital Mark@lemmy.sdf.orgtoProgrammer Humor@programming.dev•Are IDEs really like this ?linkfedilinkEnglisharrow-up1·29 days agoI only use nerdtree, and bind some scripts to F-keys. Haven’t updated in a couple years, just works. linkfedilink
print( ["even", "odd"][num % 2] )
If you need to avoid evaluating the wrong branch:
print( [lambda: "even", lambda: "odd"][num % 2]() )