49
Last seen 5 hours ago
Member for 10 years, 4 months
Difficulty Normal
from Japan. hobby programmer. start Python from CheckiO.
The portion of code below
x and f(x[0]) + f(x[1:])
is same as following.
[] if x == [] else f(x[0]) + f(x[1:])
More
A little shorter
count_gold=f=lambda p,n=0,x=0:n-len(p)and p[n][x]+max(f(p,n+1,x),f(p,n+1,x+1))
More
I was able to improve the code, thanks to the valuable advice.
The old code is here. http://www.checkio.org/mission/min-max/publications/Sim0000/python-3/first/
More
Nice hacking!
In my local PC, this trick doesn't work. This is because Python 3.3.4 doesn't have \_\_import\_\_.\_\_globals\_\_. CheckiO uses Python 3.3.2.
More
I can write more simple. See revised version http://www.checkio.org/mission/striped-words/publications/Sim0000/python-3/translate-2/ .
More
Thanks veky.
This version is faster than old one. Here is old version http://www.checkio.org/mission/super-root/publications/Sim0000/python-3/newton-method/ .
More
Nice. You can use eval() such as follows.
return eval(operation+'(x,y)')
More
same as [mine](http://www.checkio.org/mission/boolean-algebra/publications/Sim0000/python-3/dict/) :-)
More