+2 votes
in Programming Languages by (12.4k 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

0 votes
by (22.2k points)

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

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