diff --git a/challenge.py b/challenge.py index 93a85f8..c861bc7 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 = list(filter(lambda elem: elem['language']=='python',DATA))# Using filter, generate a list with all the python devs + all_Platzi_workers = list(filter(lambda elem: elem['organization']=='Platzi',DATA)) # Using filter, generate a list with all the Platzi workers + adults = list(filter(lambda elem: elem['age']>18,DATA)) # Using filter, generate a list with all people over 18 years old + workers = list(map(lambda elem: {'name': elem['name'], 'organization': elem['organization'],'homeless':'True'} if (elem['organization'] != '') else {'name': elem['name'],'organization': elem['organization'],'homeless':'False'},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 elem: {'name': elem['name'],'age': elem['age'], 'old':'True'} if (elem['age'] >= 18) else {'name': elem['name'],'age': elem['age'],'old':'False'},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: