From 665f6f2c30febc7c39d8001bbfeedb1623d04ffa Mon Sep 17 00:00:00 2001 From: Yeferson Guarin Date: Tue, 11 Aug 2020 14:33:19 -0500 Subject: [PATCH] resolviendo reto funciones lambda --- challenge.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/challenge.py b/challenge.py index 93a85f8..6427071 100644 --- a/challenge.py +++ b/challenge.py @@ -74,11 +74,11 @@ def run(): - all_python_devs = # Using filter, generate a list with all the python devs - all_Platzi_workers = # Using filter, generate a list with all the Platzi workers - adults = # Using filter, generate a list with all people over 18 years old - workers = # Using map, generate a new list of people with a key 'homeless' with True or False values, if 'organization' have something or not - old_people = # Using map, generate a new list of people with a key 'old' with True or False values, if 'age' is greater than 30 or not + all_python_devs = filter(lambda d: d['language']=='python' ,DATA) # Using filter, generate a list with all the python devs + all_Platzi_workers = filter(lambda d: d['organization']=='Platzi' ,DATA) # Using filter, generate a list with all the Platzi workers + adults = filter(lambda d: d['age']>18 ,DATA) # Using filter, generate a list with all people over 18 years old + workers = list(map(lambda d: {**d,'homeless':d['organization']!=''}, DATA)) # Using map, generate a new list of people with a key 'homeless' with True or False values, if 'organization' have something or not + old_people = list(map(lambda d: {**d,'old':d['age']>30}, DATA)) # Using map, generate a new list of people with a key 'old' with True or False values, if 'age' is greater than 30 or not print('Python devs: ') for dev in all_python_devs: