python programming help

rafaellasav at gmail.com rafaellasav at gmail.com
Sun Dec 8 13:14:47 EST 2013


On Sunday, December 8, 2013 6:07:47 PM UTC, YBM wrote:
> 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]


sorry but i'm new to python ;p
1. it has to be in a form of a function called people and
2. how this code takes in an age and returns the names?



More information about the Python-list mailing list