Skip to content

Conversation

@FrcGustavo
Copy link

i'm tired but happy

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

]

def is_homeless(dev):
dev.update( { 'homeless': dev['organization'] == '' } )
Copy link

Choose a reason for hiding this comment

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

dev pasa por referencia, por lo que al aplicar update se modifica en DATA también. Necesitas regresar un nuevo diccionario con la modificación para no afectar tus datos de entrada.

workers = map(is_homeless , 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 = map(is_old, DATA)
Copy link

Choose a reason for hiding this comment

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

Los elementos de old_people tiene la propiedad homeless por que fueron alterados antes.

return dev

def is_old(dev):
dev.update( { 'old': dev['age'] > 30 } )
Copy link

Choose a reason for hiding this comment

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

Aquí también deberías de hacer un nuevo diccionario.

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