2013-01-10から1日間の記事一覧

Pythonを使ってFizzBuzz、乗算(*)除算(/)余算(%)なしの一行で

mapとかreduceを覚えたので前回の書き直し 今回 [(s[0]!='F' and s.find('B')+1) and s[-4:] or s for s in reduce(lambda x,y: x+[(x[-3][0]=='F' and 'Fizz' or str(y+6))+(x[-5].find('B')+1 and 'Buzz' or ''),], xrange(100), ['1', '2', 'Fizz', '4', …