Skip to content

Conversation

@iraidamercedes
Copy link

No description provided.

Copy link

@hyfi06 hyfi06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

env.bak/
venv.bak/

reto07/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unas el nombre convencional de ENV para tu entorno, como vez está arriba ignorado.

challenge.py Outdated
Comment on lines 83 to 92
'''
def homeless(values):
if values['organization'] == '':
values['Homeless'] = True
else:
values['Homeless'] = False
return values
workers = list(map(homeless, DATA))
'''
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es mejor hacer un commit para guardar esto. Trata de dejar limpio tu código

challenge.py Outdated
old_people = list(map(lambda x: dict(x, **{'old':True}) if x['age'] > 30 else dict(x, **{'Old':False}), DATA))

'''
def homeless(values):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aquí pasan por referencia así que modificas directamente DATA.

challenge.py Outdated

'''
def homeless(values):
if values['organization'] == '':
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto ya es un booleano

all_python_devs = filter(lambda x : x['language'] == 'python', DATA)
all_Platzi_workers = filter(lambda x : x['organization'] == 'Platzi', DATA)
adults = filter(lambda x : x['age'] > 18, DATA)
workers = list(map(lambda x: dict(x, **{'Homeless':True}) if x['organization'] == '' else dict(x, **{'Homeless':False}), DATA))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prioriza que tu código sea entendible sobre que sera corto. DRY! dict(x, **{'Homeless':True}) esto está dos veces, una mejora sería:

list(map( lambda x: dict(x, **{'homeless': True if x['organization'] == '' else False }), DATA))

Pero no requieres el if, por que x['organization'] == '' ya es booleano.

list(map( lambda x: dict(x, **{'homeless': x['organization'] == '' }), DATA))

all_Platzi_workers = filter(lambda x : x['organization'] == 'Platzi', DATA)
adults = filter(lambda x : x['age'] > 18, DATA)
workers = list(map(lambda x: dict(x, **{'Homeless':True}) if x['organization'] == '' else dict(x, **{'Homeless':False}), DATA))
old_people = list(map(lambda x: dict(x, **{'old':True}) if x['age'] > 30 else dict(x, **{'Old':False}), DATA))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list(map(lambda x: dict(x, **{'old': x['age'] > 30 }), DATA))

Comment on lines +77 to +79
all_python_devs = filter(lambda x : x['language'] == 'python', DATA)
all_Platzi_workers = filter(lambda x : x['organization'] == 'Platzi', DATA)
adults = filter(lambda x : x['age'] > 18, DATA)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants