-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmusicalscales.py
33 lines (33 loc) · 1.04 KB
/
musicalscales.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def musicalscales():
indexDict = dict()
notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
valid = []
scales = []
songString = ""
song = []
noteNum = 0
displayed = False
noteNum = input()
constructstring = ""
for i in range(0,len(notes)):
indexDict.update({notes[i]:i})
for i in range(0,len(notes)):
scales.append([notes[i], notes[(i+2) % 12], notes[(i+4) % 12],
notes[(i+5) % 12], notes[(i+7) % 12], notes[(i+9) % 12],
notes[(i + 11) % 12], notes[i]])
songString = raw_input()
song = songString.split()
for i in notes:
valid.append(True)
for i in song: #notes in song
for j in range(0,len(scales)): #for each scale in scales
if i not in scales[j]:
valid[j] = False
for i in range(0,len(valid)):
if valid[i]:
displayed = True
constructstring += scales[i][0] + " "
if not displayed:
constructstring += "none"
print constructstring
musicalscales()