Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ajuc
8 months ago
|
parent
|
context
|
favorite
| on:
What makes code hard to read: Visual patterns of c...
I love code golf as much as anyone, not sure it's worth it on such small methods tho. Any of the propositions would be fine. Anyway:
def oddness(n): return ["Even", "Odd"][n % 2]
BTW this trick with replacing if-then-else with a lookup is sometimes very useful. Especially if there's many ifs.
pasc1878
8 months ago
[–]
Or your write in APL
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: