+2 votes
in Programming Languages by (63.5k points)
edited by

I am trying to print the sum of all values of a dictionary, but I am getting the following error:

Traceback (most recent call last):

  File "test.py", line 41, in <module>

    print ('Total...{0}'.format(sum(mv_label.values)))

TypeError: 'builtin_function_or_method' object is not iterable

What is missing in the print statement? 

1 Answer

+1 vote
by (271k points)
selected by
Best answer

You are mising '()' after values. It should be values() not values

print ('Total...{0}'.format(sum(mv_label.values())))