You can use print while calling the function. Try calling the function with different values to satify various conditions in your function.
For example:
print subsetSum(tot, vals, mem)
Alternatively you can add print statements in the function wherever you want to see the value.
For example:
def subsetSum(tot, vals, mem={}):
key = (tot, len(vals))
if key not in mem:
if tot == 0:
mem[key] = True
return True
if tot < 0 or len(vals) == 0:
print tot, len(vals) #Added a print statement here
mem[key] = False
return False
return subsetSum(tot, vals[:-1], mem) or
subsetSum(tot-vals[-1], vals[:-1], mem)
else:
return mem[key]