I'm just learning myself, so feel free to berate me if I've done something wrong, but this code avoids using global variables, it also uses raw_input instead of input which makes error handling easier, and it of course turns the strings a and b into integers before it adds them. Otherwise if A is 3 and B is 4, it will print the string assigned to a, and the string assigned to b, one after the other, which is 34. You do get errors if you enter something other than an integer, but that's easily avoided.
Code:
a = 0
b = 0
def add(a,b):
print a,"+",b,"=",a+b
def inputnum(a, b):
a=raw_input("First number: ")
b=raw_input("Second number: ")
return a, b
a, b = inputnum(a,b)
a = int(a)
b = int(b)
add(a,b)