Skip to content

Instantly share code, notes, and snippets.

@nikoloz-pachuashvili
Last active August 29, 2015 14:11
Show Gist options
  • Save nikoloz-pachuashvili/4443e01a777869660cd8 to your computer and use it in GitHub Desktop.
Save nikoloz-pachuashvili/4443e01a777869660cd8 to your computer and use it in GitHub Desktop.
Python iterator/generator
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