From 431b8c22f664c2a04faa06ad8cb6ec8557a2c068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Mart=C3=ADnez?= Date: Fri, 3 Jul 2020 20:36:24 -0500 Subject: [PATCH 1/2] Solucion Challenge 7 --- challenge.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/challenge.py b/challenge.py index 93a85f8..5954be6 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'], 'homeless':'True'} if (elem['age'] >= 18) else {'name': elem['name'],'age': elem['age'],'homeless':'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: From 86b848c1f263f66376618560d9653457dd11aaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Mart=C3=ADnez?= Date: Sat, 4 Jul 2020 07:35:12 -0500 Subject: [PATCH 2/2] Correccion llave old people --- challenge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge.py b/challenge.py index 5954be6..c861bc7 100644 --- a/challenge.py +++ b/challenge.py @@ -78,7 +78,7 @@ def run(): 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'], 'homeless':'True'} if (elem['age'] >= 18) else {'name': elem['name'],'age': elem['age'],'homeless':'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 + 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: