Last active
August 29, 2015 14:11
-
-
Save nikoloz-pachuashvili/4443e01a777869660cd8 to your computer and use it in GitHub Desktop.
Python iterator/generator
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
import itertools | |
def scala_di_do_maggiore(): | |
"""Scala di do maggiore""" | |
yield "do" | |
yield "re" | |
yield "mi" | |
yield "fa" | |
yield "sol" | |
yield "la" | |
yield "si" | |
yield "do" | |
ascendente = scala_di_do_maggiore() | |
discendente = reversed(list(scala_di_do_maggiore())) | |
for nota in itertools.chain(ascendente, discendente): | |
print nota |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment