Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ngkabra
on Dec 21, 2011
|
parent
|
context
|
favorite
| on:
Silly Python riddle
At 12 characters, this is definitely not the shortest, but it is a totally different approach than the other solutions:
>>> f = lambda: g()if 0 else(1) >>> f() 1
jerfelix
on Dec 21, 2011
[–]
Creative solution! You can knock it down a character by removing the "1" and simply returning an empty tuple.
>>> f = lambda: g()if 0 else() >>> f() ()
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: