- Notifications
You must be signed in to change notification settings - Fork250
exercises 06-lambda-functions to 10-Array-Methods#55
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
alesanchezr merged 37 commits into4GeeksAcademy:masterfromjosemoracard:jose4-06-lambda-functionsDec 6, 2023
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
37 commits Select commitHold shift + click to select a range
b3fbd36
Update README.es.md
josemoracarda96cd35
Update README.es.md
josemoracard117bc32
Update README.md
josemoracardb8b422f
Update README.md
josemoracarde1d8fe2
Update README.es.md
josemoracard4ed8919
Update README.md
josemoracardd006197
Update app.py
josemoracarde158501
Update tests.py
josemoracardf7e459f
Update tests.py
josemoracard0d2ba13
Update tests.py
josemoracard0de3fbf
Create solution.hide.py
josemoracard7877337
Update README.md
josemoracard7c657c2
Update README.md
josemoracard7f5cc84
Update README.es.md
josemoracarda18d892
Update app.py
josemoracard0280a20
Update solution.hide.py
josemoracarddaa03e4
Update tests.py
josemoracard44a898b
Update README.md
josemoracard930f773
Update README.md
josemoracard08490fe
Update README.es.md
josemoracardeaefd88
Update app.py
josemoracard50e2eec
Update test.py
josemoracard114310e
Create solution.hide.py
josemoracard989a756
Update README.md
josemoracardcecf0db
Update README.es.md
josemoracard71fe9b0
Update solution.hide.py
josemoracardaf4d5fd
Update README.es.md
josemoracard91c9d46
Update README.md
josemoracarda5eafd9
Update README.md
josemoracard3f6d997
Update README.md
josemoracard8bfd0bc
Update README.es.md
josemoracard4b35a98
Update solution.hide.py
josemoracard3c02856
Update app.py
josemoracarda229f30
Update README.md
josemoracard355a13a
Update tests.py
josemoracardb681c43
Update README.md
josemoracarda438081
Update README.es.md
josemoracardFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
22 changes: 12 additions & 10 deletionsexercises/06-lambda-functions/README.es.md
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 |
---|---|---|
@@ -1,39 +1,41 @@ | ||
# `06` LambdaFunctions in Python | ||
Una **función lambda** es una función con solo una línea de código y sin nombre. | ||
Es un tipo de función muy especial en el mundo Python porque puedes usarla como una pequeña utilidad para una programación muy ágil: | ||
```python | ||
#Declarando una función normal para una multiplicación | ||
def multiply(p1, p2): | ||
return p1 * p2 | ||
#Declarándola en una línea como una función lambda | ||
multiply = lambda p1,p2: p1 * p2 | ||
``` | ||
### 👉 Caracteristicas: | ||
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. Caterísticas | ||
+ Las **funciones lambda**tienen que ser siempre muy pequeñas. | ||
+ Las **funciones lambda**pueden tener únicamente unalínea. | ||
+ Las **funciones lambda** no necesitan un `return`, se asume que lo que haya en esa línea devolverá un valor. | ||
+ Las **funciones lambda** pueden almacenarse en variables o ser pasadas como parámetro a otra función. | ||
## 📝 Instrucciones: | ||
1. Crea una variable llamada `is_odd`. | ||
2. Asígnale una función**lambda** que devuelva `True` o `False` dependiendo de si un número dado es impar o no. | ||
## 💡 Pista: | ||
+ Así es como declararías una función normal: | ||
```python | ||
# Esta función retorna"True" si el número es impar | ||
def is_odd(num): | ||
return (num % 2) != 0 | ||
``` |
23 changes: 12 additions & 11 deletionsexercises/06-lambda-functions/README.md
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
2 changes: 1 addition & 1 deletionexercises/06-lambda-functions/app.py
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#Your function here | ||
3 changes: 3 additions & 0 deletionsexercises/06-lambda-functions/solution.hide.py
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Your function here | ||
is_odd = lambda num: num % 2 != 0 |
6 changes: 3 additions & 3 deletionsexercises/06-lambda-functions/tests.py
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
11 changes: 5 additions & 6 deletionsexercises/07-lambda-function-two/README.es.md
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
16 changes: 8 additions & 8 deletionsexercises/07-lambda-function-two/README.md
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
4 changes: 2 additions & 2 deletionsexercises/07-lambda-function-two/app.py
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#Your codeabove,please do not change code below | ||
print(rapid("bob")) # Shouldprint"bo" |
5 changes: 2 additions & 3 deletionsexercises/07-lambda-function-two/solution.hide.py
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
rapid = lambda myStr: myStr[:-1] | ||
# Your code above, please do not change code below | ||
print(rapid("bob")) # Should print "bo" |
4 changes: 2 additions & 2 deletionsexercises/07-lambda-function-two/tests.py
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
12 changes: 7 additions & 5 deletionsexercises/08-Function-that-returns/README.es.md
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
7 changes: 3 additions & 4 deletionsexercises/08-Function-that-returns/README.md
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
6 changes: 3 additions & 3 deletionsexercises/08-Function-that-returns/app.py
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
def dollar_to_euro(dollar_value): | ||
return dollar_value * 0.91 | ||
def euro_to_yen(euro_value): | ||
return euro_value *161.70 | ||
####### ↓ YOUR CODE BELOW ↓ ####### |
12 changes: 12 additions & 0 deletionsexercises/08-Function-that-returns/solution.hide.py
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def dollar_to_euro(dollar_value): | ||
return dollar_value * 0.91 | ||
def euro_to_yen(euro_value): | ||
return euro_value * 161.70 | ||
####### ↓ YOUR CODE BELOW ↓ ####### | ||
euros = dollar_to_euro(137) | ||
yen = euro_to_yen(euros) | ||
print(yen) |
6 changes: 3 additions & 3 deletionsexercises/08-Function-that-returns/test.py
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
12 changes: 7 additions & 5 deletionsexercises/09-Function-parameters/README.es.md
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
10 changes: 6 additions & 4 deletionsexercises/09-Function-parameters/README.md
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
6 changes: 3 additions & 3 deletionsexercises/09-Function-parameters/solution.hide.py
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Your code goes here: | ||
def render_person(name,birth_date, eye_color, age,gender): | ||
return name +" is a "+ str(age) +" years old " +gender +" born in " +birth_date + " with " +eye_color +" eyes" | ||
# Do not edit below this line | ||
print(render_person('Bob', '05/22/1983', 'green', 23, 'male')) |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.