On 20 июн, 11:31, Duncan Booth <[EMAIL PROTECTED]> wrote: > Terry Reedy <[EMAIL PROTECTED]> wrote: > >> [['Fizz', 'Buzz', 'FizzBuzz', str(i)][62/(pow(i, 4, 15) + 1)%4] for i > >> in xrange(1, 101)] > > > These make the lookup table variable, so it has to be recalculated for > > each i. > > So what? Mark Wooding was posting about mathematical elegance and came up > with that really neat pow() call. If runtime came into it then one of the > previous solutions or (as Mark already said) a straightforward sometable[i% > 15] is going beat something like this hands-down. > > This is coding for fun not profit. > > -- > Duncan Boothhttp://kupuguy.blogspot.com
I can't resist... [[i,"Fizz","Buzz","FizzBuzz"][(not i%3)+(not i%5)*2] for i in range(1, 101)] Ivan -- http://mail.python.org/mailman/listinfo/python-list