Switch dictionary in Python not converting int and str correctly -


followed on previous question, i've written switch dictionary replace switch statements in functions. i've placed dictionary under def f(x) after receiving user input, so. function should write whatever matched in dictionary 'a' , 'b', can used in add() function.

while loop == 1: choice = menu() if choice == '1':     = str(input("enter note: "))     b = str(input("enter interval: "))      def f(x):         notes = {             'c': 0,             'cs': 1,             'd': 2,             'ds': 3,             'e': 4,             'f':5,             'fs': 6,             'g': 7,             'gs': 8,             'a': 9,             'as': 10,             'b': 11,             }         return = notes[x]       def g(x):         intervals = {             'm2': 1,             'mj2': 2,             'm3': 3,             'mj3': 4,             'p4': 5,             't': 6,             'p5': 7,             'm6': 8,             'mj6': 9,             'm7': 10,             'mj7': 11,             }         return intervals[x]      f (a)     g (b)     add(a, b) 

however getting 'not arguments converted during string formatting' error @ these 2 lines:

add(a, b) 

and @ beginning of script define add function.

def add(a,b): print ((a), "+", (b), "=", (a + b) %12) 

i'm not sure how fix problem, don't understand how code converting strings. functions expecting integers , instead receiving strings?

thank you!

try this:

def add(va,vb):     print ((va), "+", (vb), "=", (va + vb) %12)  aa =  f(a) bb =  g(b) add(aa, bb)