Skip to content

Instantly share code, notes, and snippets.

@fumieval
Created June 4, 2012 13:22
Show Gist options
  • Save fumieval/2868336 to your computer and use it in GitHub Desktop.
Save fumieval/2868336 to your computer and use it in GitHub Desktop.
以下のプログラムの出力結果を答えよ。
# coding: utf-8
import itertools as I
def it():
yield 1
yield 0
yield 1
a, b, c = it(), I.islice(it(), 1, None), I.islice(it(), 2, None)
for i in I.imap(int.__add__, I.imap(int.__mul__, a, b), c):
yield i
if __name__ == "__main__":
print list(I.islice(it(), 11)).__repr__()
# 正解: https://gist.github.com/2868458
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment