-
Notifications
You must be signed in to change notification settings - Fork 27
Challenge is hard #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FrcGustavo
wants to merge
1
commit into
PlatziMaster:master
Choose a base branch
from
FrcGustavo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,15 +71,31 @@ | |
| }, | ||
| ] | ||
|
|
||
| def is_homeless(dev): | ||
| dev.update( { 'homeless': dev['organization'] == '' } ) | ||
| return dev | ||
|
|
||
| def is_old(dev): | ||
| dev.update( { 'old': dev['age'] > 30 } ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aquí también deberías de hacer un nuevo diccionario. |
||
| return dev | ||
|
|
||
|
|
||
| def run(): | ||
| # Using filter, generate a list with all the python devs | ||
| all_python_devs = filter(lambda dev: dev['language'] == 'python', DATA) | ||
|
|
||
| # Using filter, generate a list with all the Platzi workers | ||
| all_Platzi_workers = filter(lambda dev: dev['organization'] == 'Platzi', DATA) | ||
|
|
||
| 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 people over 18 years old | ||
| adults = filter(lambda dev: dev['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 = 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) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Los elementos de |
||
|
|
||
| print('Python devs: ') | ||
| for dev in all_python_devs: | ||
| print(dev['name']) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devpasa por referencia, por lo que al aplicarupdatese modifica en DATA también. Necesitas regresar un nuevo diccionario con la modificación para no afectar tus datos de entrada.