The program takes all the inputs properly, however when the user enters all the chords that need to be transposed, the program only performs a positive shift on them(it doesn't execute the negative shift part of the if statement)
I have realised that if I swap the positive and negative shift parts of the program around. The program only performs negative shifts and I cant figure out how to solve this.(The elif sign == '2' onward is being skipped) problem persists if or part of the statement is removed from both branches of the if statement
usr_list = ['A','BB','B','C','C#','D','EB','E','F','F#','G','AB']
while len(u_list)>0:
chord = (u_list[0])
if sign == '1' or '+':
sign = '+'
chord_value = int(usr_list.index(chord))
chord_transpose = chord_value + t_key
if chord_transpose >= 12:
chord_transpose = chord_transpose - 12
print('Greater than 12',usr_list[chord_transpose])
elif chord_transpose < 12:
del u_list[0]
t_list.append(usr_list[chord_transpose])
else:
print('Invalid')
elif sign == '2' or '-':
sign = '-'
chord_value = int(usr_list.index(chord))
chord_transpose = chord_value - t_key
if chord_transpose >= 12:
chord_transpose = chord_transpose + 12
print('Greater than 12',usr_list[chord_transpose])
elif chord_transpose < 12:
del u_list[0]
t_list.append(usr_list[chord_transpose])
else:
print('Invalid')
else:
print('Invalid')
print('transposition of those chords by',sign+str(t_key),'is',t_list)
when the user enters a transposition value between 1 & 12 and chooses chords from the list , transposition of their chosen symbol should be performed either positive or negative but for some reason even when user chooses a negative transposition, the program performs a positive shift