+2 votes
in Programming Languages by (77.8k points)

The following python code is throwing error. Am I missing something in the code?

   for k, v in p1_coded_by_age.items:
            total+=sum(v)
            if k in p0_coded_by_age:
                total+=sum(p0_coded_by_age[k])
        print ('Total coded....{0}'.format(total))

1 Answer

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

Change

for k, v in p1_coded_by_age.items

to

for k, v in p1_coded_by_age.items()

You are missing () after items.


...