Read this: New Users, Read This
function doesn't make much sense.
Inside it, you use the lambda
keyword to create a function which returns what you want the outer function to return.
Either of these two would work(I would recommend using the one with def
- Code: Select all
return [name for name in dic if dic[name] == age]
# you don't ever wanna be using this one
people = lambda age: [name for name in dic if dic[name] == age]
Also, rather than mutating the global dic
, you should create the dict inside it and return it.
would make that function trivial.