From e3933c775d42217113826c9382a61c8ab2e4e047 Mon Sep 17 00:00:00 2001 From: Jaime Escobedo Date: Wed, 7 Oct 2020 22:57:40 -0500 Subject: [PATCH] Reto resuelto --- challenge.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/challenge.py b/challenge.py index 93a85f8..cc6190d 100644 --- a/challenge.py +++ b/challenge.py @@ -73,12 +73,20 @@ def run(): + # Using filter, generate a list with all the python devs + all_python_devs = filter(lambda pyDevs: pyDevs['language'] == 'python', DATA) - 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 + # Using filter, generate a list with all the Platzi workers + all_Platzi_workers = filter(lambda plWr : plWr['organization'] == 'Platzi', DATA) + + # Using filter, generate a list with all people over 18 years old + adults = filter(lambda adl: adl['age'] >=18, DATA) + + # Using map, generate a new list of people with a key 'homeless' with True or False values, if 'organization' have something or not + workers = list(map(lambda d: {**d,'homeless':d['organization']!=''}, 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 + old_people = list(map(lambda d: {**d,'old':d['age']>30}, DATA)) print('Python devs: ') for dev in all_python_devs: