On Apr 2, 7:52 am, Tim Chase <python.l...@tim.thechases.com> wrote: > Steve Howell wrote: > > I forgot this one: > > > def obfuscated_triager(rolls, pins, > > lookup = ['normal'] * 10 + ['strike'] + [None] * 9 + ['spare'] > > ): > > return lookup[rolls * pins] > > Bah...no need to be _quite_ so obscure: > def triager(rolls, pins): > return { > (1, 10):'strike', > (2,10):'spare', > (2,0):'wow, you stink', > }.get((rolls, pins), 'normal') > > ;-) >
Well played. -- http://mail.python.org/mailman/listinfo/python-list