diff --git a/challenge.py b/challenge.py index 93a85f8..b1d55f0 100644 --- a/challenge.py +++ b/challenge.py @@ -74,11 +74,20 @@ 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 + # Using filter, generate a list with all the python devs + all_python_devs = list(filter(lambda item: item['language'] == 'python', DATA)) + + # Using filter, generate a list with all the Platzi workers + all_Platzi_workers = list(filter(lambda item: item['organization'] == 'Platzi', DATA)) + + # Using filter, generate a list with all people over 18 years old + adults = list(filter(lambda item: item['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 item: dict(item, **{'homeless': item['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 item: dict(item, **{'old': item['age'] > 30}), DATA)) print('Python devs: ') for dev in all_python_devs: