I'm creating the stable matching project in Python, and I'm trying to iterate over the keys of a dict using iterkeys(), but I'm getting the following error:
AttributeError: dict object has no attribute iterkeys
This is my dict:
preferred_rankings_men = {
'ryan': ['lizzy', 'sarah', 'zoey', 'daniella'],
'josh': ['sarah', 'lizzy', 'daniella', 'zoey'],
'blake': ['sarah', 'daniella', 'zoey', 'lizzy'],
'connor': ['lizzy', 'sarah', 'zoey', 'daniella']
}
And here is my function:
def init_free_men():
for man in preferred_rankings_men.iterkeys():
free_men.append(man)