python programming help

YBM ybmess at nooos.fr.invalid
Sun Dec 8 13:07:47 EST 2013


Le 08.12.2013 18:59, rafaellasav at gmail.com a écrit :
> i have a dictionary with names and ages for each name.
> I want to write a function that takes in an age and returns
> the names of all the people who are that age.
> please help

ageDict = { 'john':42, 'jane':36, 'paul':42 }
peopleWithAge = lambda age: [ name for name in ageDict if
			      ageDict[name]==age]





More information about the Python-list mailing list