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

0 votes
by (17.9k points)

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.

...