[BangPypers] SPOJ: Kamil -> Code Golf

Abhishek Mishra ideamonk at gmail.com
Sun Nov 15 07:28:19 CET 2009


I tried a lot, I give up. But I noticed this,

if 'foo'.count (sub, [start, end])
allowed us to place a regexp in place of sub, we could've shortened it.
But unfortunately we need to import re and compile one before using.

So achieving something like
foo = 'FILIPEK'
q=1;foo.gsub(/[DTFL]/){q*=2} p q}

is not possible. In the above ruby code mainly gsub and 'p' as a
shorthand for print is helping out.

Python is really made for writing readable code :P
The quest for 53 bytes py code is still on.

regards,
Abhishek Mishra


More information about the BangPypers mailing list