From f3a040982dcad817b73b95f30e53771864dec1a6 Mon Sep 17 00:00:00 2001 From: khamidou Date: Thu, 11 Aug 2011 14:26:08 +0200 Subject: [PATCH] cleaned dup code --- scales.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scales.py b/scales.py index c066d8e..9ee7a24 100644 --- a/scales.py +++ b/scales.py @@ -83,15 +83,10 @@ class Scale: i = 0 j = 0 while i < 11 and j < 6: # reduce(lambda x,y: x+y, self.values) - note = notes[i] - if self.formula[j] == 1: - retscale += notes[i+1] - i += 1 - elif self.formula[j] == 2: - retscale += notes[i+2] - i += 2 - - j += 1 + n = self.formula[i] + retscale += notes[i+n] + i += n + j += 1 # Don't forget to increment j to avoid looping. retscale += " " return retscale -- 2.43.0