User:Contribution/Ups & downs notation in Python: Difference between revisions

Contribution (talk | contribs)
No edit summary
Contribution (talk | contribs)
No edit summary
Line 2: Line 2:
def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):
def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):
     sharpness = 7 * steps_per_fifth - 4 * steps_per_octave
     sharpness = 7 * steps_per_fifth - 4 * steps_per_octave
     POS_ALTS, NEG_ALTS = ({(-1) ** (i + 1) * i for i in range(1, 6)}, {(-1) ** i * i for i in range(1, 6)})
     POS_ALTS, NEG_ALTS = ({(i if i % 2 else -i) for i in range(1, 6)}, {(-i if i % 2 else i) for i in range(1, 6)})


     naturals = []
     naturals = []