Friday, 23 August 2013

Iterating Over a Dictionary

Iterating Over a Dictionary

I am trying to return all the values in a dictionary that have a value
greater than the int argurment.
def big_keys(dict, int):
count = []
for u in dict:
if u > int:
count.append(u)
return count
I don't understand why this isn't working. It returns every value in the
list rather than just those which are greater than in.

No comments:

Post a Comment