Created
June 4, 2012 13:22
-
-
Save fumieval/2868336 to your computer and use it in GitHub Desktop.
以下のプログラムの出力結果を答えよ。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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