From b3fbd36b343c04f7c76e48fd09e7ad4ee83b8bc9 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:49:37 +0100 Subject: [PATCH 01/37] Update README.es.md --- exercises/06-lambda-functions/README.es.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/06-lambda-functions/README.es.md b/exercises/06-lambda-functions/README.es.md index a12cdf6..fa629e3 100644 --- a/exercises/06-lambda-functions/README.es.md +++ b/exercises/06-lambda-functions/README.es.md @@ -5,15 +5,15 @@ Una **función lambda** es una función con solo una línea de código y sin nom 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 +# 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 +# Declarándola en una línea como una función lambda multiply = lambda p1,p2: p1 * p2 ``` -1. Las **funciones lambda** tiene que ser siempre muy pequeñas. +1. Las **funciones lambda** tienen que ser siempre muy pequeñas. 2. Las **funciones lambda** pueden tener únicamente una línea. @@ -26,14 +26,14 @@ multiply = lambda p1,p2: p1 * p2 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. +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 +# Esta función retorna "True" si el número es impar def is_odd(num): return (num % 2) != 0 ``` From a96cd3548897a2042639c9cdde5444dd9a8aba22 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:50:45 +0100 Subject: [PATCH 02/37] Update README.es.md --- exercises/06-lambda-functions/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/06-lambda-functions/README.es.md b/exercises/06-lambda-functions/README.es.md index fa629e3..97b1343 100644 --- a/exercises/06-lambda-functions/README.es.md +++ b/exercises/06-lambda-functions/README.es.md @@ -1,4 +1,4 @@ -# `06` Funciones Lambda en Python +# `06` Lambda Functions in Python Una **función lambda** es una función con solo una línea de código y sin nombre. From 117bc32069eb067cc1c4b28517ddd93ed723af48 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:56:20 +0100 Subject: [PATCH 03/37] Update README.md --- exercises/06-lambda-functions/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/exercises/06-lambda-functions/README.md b/exercises/06-lambda-functions/README.md index dd38458..202169f 100755 --- a/exercises/06-lambda-functions/README.md +++ b/exercises/06-lambda-functions/README.md @@ -3,29 +3,29 @@ tutorial: "https://www.youtube.com/watch?v=HACQ9uerCuE" --- -# `06` Lambda functions in Python +# `06` Lambda Functions in Python A **lambda function** is a function with just one line of code and no name. -It is a very special type of funcion in the world of python because you can use it as a small utility for very agile coding: +It is a very special type of function in the world of Python because you can use it as a small utility for very agile coding: ```python -# declaring a normal funcion for multiplication +# Declaring a normal function for multiplication def multiply(p1, p2): return p1 * p2 -# declaring it now like a one line lambda +# Declaring it now like a one line lambda function multiply = lambda p1,p2: p1 * p2 ``` -:point_uo:Facts: +👉 Facts: -+ **Lambda fuctions** have to be always very small. ++ **Lambda functions** have to always be very small. -+ **Lambda function** can only have one line. ++ **Lambda functions** can only have one line. -+ **Lambda function** doesn't need a `return` statement (it is assumed that it will return whatever is on that one line). ++ **Lambda functions** don't need a `return` statement (it is assumed that it will return whatever is on that one line). -+ **Lambda functions** can be stored in variables or passed as parameters to another function ++ **Lambda functions** can be stored in variables or passed as parameters to another function. ## 📝 Instructions: @@ -33,12 +33,12 @@ multiply = lambda p1,p2: p1 * p2 2. Assign a **lambda function** to it that returns `True` or `False` if a given number is odd. -## 💡Hint +## 💡 Hint + Here is how you would declare it like a normal function: ```py -# this function return True if a number is odd. +# This function returns True if a number is odd. def is_odd(num): return num % 2 != 0 ``` From b8b422f36ff51612dd2a3ca976630e5b280a64a2 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:56:41 +0100 Subject: [PATCH 04/37] Update README.md --- exercises/06-lambda-functions/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/06-lambda-functions/README.md b/exercises/06-lambda-functions/README.md index 202169f..49de6bc 100755 --- a/exercises/06-lambda-functions/README.md +++ b/exercises/06-lambda-functions/README.md @@ -17,6 +17,7 @@ def multiply(p1, p2): # Declaring it now like a one line lambda function multiply = lambda p1,p2: p1 * p2 ``` + 👉 Facts: + **Lambda functions** have to always be very small. @@ -38,7 +39,7 @@ multiply = lambda p1,p2: p1 * p2 + Here is how you would declare it like a normal function: ```py -# This function returns True if a number is odd. +# This function returns True if a number is odd def is_odd(num): return num % 2 != 0 ``` From e1d8fe2b1bc5e6778af6ed68dd0251b631aafe6a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:57:32 +0100 Subject: [PATCH 05/37] Update README.es.md --- exercises/06-lambda-functions/README.es.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/exercises/06-lambda-functions/README.es.md b/exercises/06-lambda-functions/README.es.md index 97b1343..40dcd34 100644 --- a/exercises/06-lambda-functions/README.es.md +++ b/exercises/06-lambda-functions/README.es.md @@ -2,7 +2,7 @@ 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: +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 @@ -13,13 +13,15 @@ def multiply(p1, p2): multiply = lambda p1,p2: p1 * p2 ``` -1. Las **funciones lambda** tienen que ser siempre muy pequeñas. +### 👉 Caracteristicas: -2. Las **funciones lambda** pueden tener únicamente una línea. ++ Las **funciones lambda** tienen que ser siempre muy pequeñas. -3. Las **funciones lambda** no necesitan un `return`, se asume que lo que haya en esa línea devolverá un valor. ++ Las **funciones lambda** pueden tener únicamente una línea. -4. Las **funciones lambda** pueden almacenarse en variables o ser pasadas como parámetro a otra función. ++ 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: From 4ed891992ac1299006f3d15e0f1cac964769766a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:57:39 +0100 Subject: [PATCH 06/37] Update README.md --- exercises/06-lambda-functions/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/06-lambda-functions/README.md b/exercises/06-lambda-functions/README.md index 49de6bc..771ef04 100755 --- a/exercises/06-lambda-functions/README.md +++ b/exercises/06-lambda-functions/README.md @@ -18,7 +18,7 @@ def multiply(p1, p2): multiply = lambda p1,p2: p1 * p2 ``` -👉 Facts: +### 👉 Facts: + **Lambda functions** have to always be very small. From d0061978a58be20b78356d4e34a1c7350789ef8c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:58:15 +0100 Subject: [PATCH 07/37] Update app.py --- exercises/06-lambda-functions/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/06-lambda-functions/app.py b/exercises/06-lambda-functions/app.py index e59626e..b4ac556 100755 --- a/exercises/06-lambda-functions/app.py +++ b/exercises/06-lambda-functions/app.py @@ -1,2 +1,2 @@ -# your function here +# Your function here From e1585015c20166dd3767800809e99ad01ccf7ff5 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:59:29 +0100 Subject: [PATCH 08/37] Update tests.py --- exercises/06-lambda-functions/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/06-lambda-functions/tests.py b/exercises/06-lambda-functions/tests.py index bce6293..aa3054a 100755 --- a/exercises/06-lambda-functions/tests.py +++ b/exercises/06-lambda-functions/tests.py @@ -1,6 +1,6 @@ import io, sys, pytest, os, re, mock -@pytest.mark.it("Declare a function 'is_odd' as lambda") +@pytest.mark.it("Declare a function called 'is_odd' as lambda") def test_declare_variable(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: @@ -13,7 +13,7 @@ def test_for_callable(capsys): import app as app assert callable(app.is_odd) -@pytest.mark.it('The function is_odd must receive one number and return true if is odd or false otherwise') +@pytest.mark.it('The function is_odd must receive one number and return True if the number is odd or False otherwise') def test_for_integer(capsys): import app as app assert app.is_odd(3) == True @@ -21,4 +21,4 @@ def test_for_integer(capsys): @pytest.mark.it('We tested the function with 2 and the result was not False') def test_for_integer2(capsys): import app as app - assert app.is_odd(2) == False \ No newline at end of file + assert app.is_odd(2) == False From f7e459f220fd7dd3c93284fb5884c139d969db9b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:59:44 +0100 Subject: [PATCH 09/37] Update tests.py --- exercises/06-lambda-functions/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/06-lambda-functions/tests.py b/exercises/06-lambda-functions/tests.py index aa3054a..8b8655b 100755 --- a/exercises/06-lambda-functions/tests.py +++ b/exercises/06-lambda-functions/tests.py @@ -8,7 +8,7 @@ def test_declare_variable(): regex = re.compile(r"is_odd(\s*)=(\s*)lambda") assert bool(regex.search(content)) == True -@pytest.mark.it('The function is_odd must exist') +@pytest.mark.it("The function 'is_odd' must exist") def test_for_callable(capsys): import app as app assert callable(app.is_odd) From 0d2ba13d13a2ef4b5c6a90e5f7e4358225e36476 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:00:13 +0100 Subject: [PATCH 10/37] Update tests.py --- exercises/06-lambda-functions/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/06-lambda-functions/tests.py b/exercises/06-lambda-functions/tests.py index 8b8655b..aa3054a 100755 --- a/exercises/06-lambda-functions/tests.py +++ b/exercises/06-lambda-functions/tests.py @@ -8,7 +8,7 @@ def test_declare_variable(): regex = re.compile(r"is_odd(\s*)=(\s*)lambda") assert bool(regex.search(content)) == True -@pytest.mark.it("The function 'is_odd' must exist") +@pytest.mark.it('The function is_odd must exist') def test_for_callable(capsys): import app as app assert callable(app.is_odd) From 0de3fbff5bf6e718f96e76b2f3ac07e59b367afa Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:01:52 +0100 Subject: [PATCH 11/37] Create solution.hide.py --- exercises/06-lambda-functions/solution.hide.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 exercises/06-lambda-functions/solution.hide.py diff --git a/exercises/06-lambda-functions/solution.hide.py b/exercises/06-lambda-functions/solution.hide.py new file mode 100644 index 0000000..f134619 --- /dev/null +++ b/exercises/06-lambda-functions/solution.hide.py @@ -0,0 +1,3 @@ +# Your function here + +is_odd = lambda num: num % 2 != 0 From 7877337c6b1f88c93ebd701e624c0c3bdc08a1d3 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:05:52 +0100 Subject: [PATCH 12/37] Update README.md --- exercises/07-lambda-function-two/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exercises/07-lambda-function-two/README.md b/exercises/07-lambda-function-two/README.md index 69fa2ce..8659fd1 100755 --- a/exercises/07-lambda-function-two/README.md +++ b/exercises/07-lambda-function-two/README.md @@ -2,23 +2,23 @@ tutorial: "https://www.youtube.com/watch?v=1HwmTkQPeMo" --- -# `07` Lambda functions +# `07` Lambda Functions -**:point_up: Remember:** +### ☝ Remember: Lambda functions allows a short syntax for writing function expressions. ```python -multy = lambda x, y: x * y -print(multy(2,2)) +multi = lambda x, y: x * y +print(multi(2,2)) ``` ## 📝 Instructions: -1. Create a lambda function called `rapid` it will take one string parameter. +1. Create a lambda function called `rapid`, which will take one string parameter. 2. Return the same string with the last letter removed. -## 💡 Hint +## 💡 Hint: -+ Google how to "remove last letter form string python" (you can use the square brackets). ++ Google "how to remove last letter from string python" (you can use the square brackets). From 7c657c271daf6e1c22cd68048a73943677b3b369 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:06:37 +0100 Subject: [PATCH 13/37] Update README.md --- exercises/07-lambda-function-two/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/07-lambda-function-two/README.md b/exercises/07-lambda-function-two/README.md index 8659fd1..dcad70e 100755 --- a/exercises/07-lambda-function-two/README.md +++ b/exercises/07-lambda-function-two/README.md @@ -6,7 +6,7 @@ tutorial: "https://www.youtube.com/watch?v=1HwmTkQPeMo" ### ☝ Remember: -Lambda functions allows a short syntax for writing function expressions. +Lambda functions allow a short syntax for writing function expressions. ```python multi = lambda x, y: x * y From 7f5cc84ec62cbe5d234a2001ab9377f99e0b7233 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:10:39 +0100 Subject: [PATCH 14/37] Update README.es.md --- exercises/07-lambda-function-two/README.es.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/exercises/07-lambda-function-two/README.es.md b/exercises/07-lambda-function-two/README.es.md index e9f470b..53c054e 100644 --- a/exercises/07-lambda-function-two/README.es.md +++ b/exercises/07-lambda-function-two/README.es.md @@ -1,13 +1,12 @@ -# `07` Funciones Lambda +# `07` Lambda Functions - -**:point_up: Recuerda:** +### ☝ Recuerda: Las funciones Lambda permiten una sintaxis corta para escribir expresiones de funciones. ```python -multy = lambda x, y: x * y -print(multy(2,2)) +multi = lambda x, y: x * y +print(multi(2,2)) ``` ## 📝 Instrucciones: @@ -18,4 +17,4 @@ print(multy(2,2)) ## 💡 Pista: -+ Busca en Google "remove last letter form string python" (puedes usar los corchetes). ++ Busca en Google "como eliminar el último caracter de un string python" (puedes usar los corchetes). From a18d892882154e6a8ec105afbc9a1ef2e3a012bf Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:11:54 +0100 Subject: [PATCH 15/37] Update app.py --- exercises/07-lambda-function-two/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/07-lambda-function-two/app.py b/exercises/07-lambda-function-two/app.py index fca265d..a156102 100755 --- a/exercises/07-lambda-function-two/app.py +++ b/exercises/07-lambda-function-two/app.py @@ -1,5 +1,5 @@ -# From this line above, plese do not change code below -print(rapid("bob")) #should print bo \ No newline at end of file +# Your code above, please do not change code below +print(rapid("bob")) # Should print "bo" From 0280a20f6b0b4bfed844a0406bedef1a1f0c67bc Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:14:22 +0100 Subject: [PATCH 16/37] Update solution.hide.py --- exercises/07-lambda-function-two/solution.hide.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/exercises/07-lambda-function-two/solution.hide.py b/exercises/07-lambda-function-two/solution.hide.py index 963f084..ecfc065 100644 --- a/exercises/07-lambda-function-two/solution.hide.py +++ b/exercises/07-lambda-function-two/solution.hide.py @@ -1,5 +1,4 @@ rapid = lambda myStr: myStr[:-1] - -# From this line above, plese do not change code below -print(rapid("bob")) #should print bo \ No newline at end of file +# Your code above, please do not change code below +print(rapid("bob")) # Should print "bo" From daa03e4b741f1daca80b997194fdcc5580132b58 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:16:33 +0100 Subject: [PATCH 17/37] Update tests.py --- exercises/07-lambda-function-two/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/07-lambda-function-two/tests.py b/exercises/07-lambda-function-two/tests.py index 39787f2..7b6a474 100755 --- a/exercises/07-lambda-function-two/tests.py +++ b/exercises/07-lambda-function-two/tests.py @@ -1,6 +1,6 @@ import io, sys, pytest, os, re, mock -@pytest.mark.it("Declare a function 'rapid' as lambda") +@pytest.mark.it("Declare a function called 'rapid' as lambda") def test_declare_variable(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: @@ -12,7 +12,7 @@ def test_declare_variable(): def test_for_callable(capsys): from app import rapid -@pytest.mark.it('The function rapid must receive one string and return the same but without the last letter (make sure it\'s lowecase)') +@pytest.mark.it('The function rapid must receive one string and return the same string without the last character') def test_for_integer(capsys): from app import rapid assert rapid("maria") == "mari" From 44a898b1fb9d4354a653438a3e25fc4f5732e80c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:29:44 +0100 Subject: [PATCH 18/37] Update README.md --- exercises/08-Function-that-returns/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/exercises/08-Function-that-returns/README.md b/exercises/08-Function-that-returns/README.md index cd56ca6..b84d2e1 100755 --- a/exercises/08-Function-that-returns/README.md +++ b/exercises/08-Function-that-returns/README.md @@ -8,18 +8,17 @@ It is very good practice that all functions return something, even if it is `Non With what your function returns, you can create algorithms that use multiple functions at the same time. -For example, in this particular case we have two functions available: +For example, in this particular case, we have two functions available: + `dollar_to_euro`: that calculates the value in euros of a given value in dollars. + `euro_to_yen`: calculates the value in yen of a given value in euros. - ## 📝 Instructions: 1. Using the two functions available, print on the console the value of **137** dollars in yen. -## 💡 Hint +## 💡 Hint: Working backwards: @@ -27,4 +26,4 @@ Working backwards: - Our available function `euro_to_yen` will provide that. -- To get to euro we will use the available function `dollar_to_euro`. +- To get the euros, we will use the available function `dollar_to_euro`. From 930f773763975a9a27c2de8f13d70707c51f5da0 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:31:16 +0100 Subject: [PATCH 19/37] Update README.md --- exercises/08-Function-that-returns/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/08-Function-that-returns/README.md b/exercises/08-Function-that-returns/README.md index b84d2e1..1f4a6d7 100755 --- a/exercises/08-Function-that-returns/README.md +++ b/exercises/08-Function-that-returns/README.md @@ -18,7 +18,7 @@ For example, in this particular case, we have two functions available: 1. Using the two functions available, print on the console the value of **137** dollars in yen. -## 💡 Hint: +## 💡 Hints: Working backwards: From 08490fe19fb2e69260a6b1742158f3cf632aacad Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:32:18 +0100 Subject: [PATCH 20/37] Update README.es.md --- exercises/08-Function-that-returns/README.es.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/exercises/08-Function-that-returns/README.es.md b/exercises/08-Function-that-returns/README.es.md index cd6fd25..add2e88 100644 --- a/exercises/08-Function-that-returns/README.es.md +++ b/exercises/08-Function-that-returns/README.es.md @@ -1,8 +1,10 @@ -# `08` Funciones que devuelven +# `08` Functions that return Es una muy buena práctica que las funciones devuelvan algo, incluso si es `None`. -Si tus funciones devuelven algo, puedes crear algoritmos que usen muchas funciones al mismo tiempo. Por ejemplo, en este caso en particular tenemos dos funciones disponibles: +Si tus funciones devuelven algo, puedes crear algoritmos que usen muchas funciones al mismo tiempo. + +Por ejemplo, en este caso en particular tenemos dos funciones disponibles: + `dollar_to_euro`: que calcula el valor en euros de un valor dado en dólares. @@ -12,12 +14,12 @@ Si tus funciones devuelven algo, puedes crear algoritmos que usen muchas funcion 1. Utilizando las dos funciones disponibles, imprime en la consola el valor de **137** dólares en yenes. -## 💡 Pista: +## 💡 Pistas: -Trabajando al revés: +Trabajando desde el final: - Nuestro valor esperado está en yenes. - Nuestra función disponible `euro_to_yen` proporcionará eso. -- Para llegar al euro utilizaremos la función disponible `dollar_to_euro`. \ No newline at end of file +- Para llegar al euro utilizaremos la función disponible `dollar_to_euro`. From eaefd88b6d4fec91a545ffe8b80e167f2b6891a6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:34:31 +0100 Subject: [PATCH 21/37] Update app.py --- exercises/08-Function-that-returns/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/08-Function-that-returns/app.py b/exercises/08-Function-that-returns/app.py index 44ab611..fc81947 100755 --- a/exercises/08-Function-that-returns/app.py +++ b/exercises/08-Function-that-returns/app.py @@ -1,7 +1,7 @@ def dollar_to_euro(dollar_value): - return dollar_value * 0.89 + return dollar_value * 0.91 def euro_to_yen(euro_value): - return euro_value * 124.15 + return euro_value * 161.70 -####### ↓ YOUR CODE BELOW ↓ ####### \ No newline at end of file +####### ↓ YOUR CODE BELOW ↓ ####### From 50e2eec84f45f9ae1388ac79513a56d3cca19794 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:35:17 +0100 Subject: [PATCH 22/37] Update test.py --- exercises/08-Function-that-returns/test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/08-Function-that-returns/test.py b/exercises/08-Function-that-returns/test.py index 812e1c7..f45e234 100755 --- a/exercises/08-Function-that-returns/test.py +++ b/exercises/08-Function-that-returns/test.py @@ -1,6 +1,6 @@ import io, sys, pytest, os, re, mock -@pytest.mark.it("Call the function dollar_to_euro passing the 137 dollars to get the amount in Euro") +@pytest.mark.it("Call the function dollar_to_euro passing 137 dollars to get the amount in Euros") def test_declare_variable(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: @@ -9,7 +9,7 @@ def test_declare_variable(): assert bool(regex.search(content)) == True -@pytest.mark.it("Call the function euro_to_yen passing the Euro converted amount to get the amount in Yen") +@pytest.mark.it("Call the function euro_to_yen passing the Euros converted amount to get the amount in Yen") def test_euro_to_yen(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: @@ -22,4 +22,4 @@ def test_euro_to_yen(): def test_for_file_output(capsys): import app captured = capsys.readouterr() - assert "15137.609500000002\n" == captured.out \ No newline at end of file + assert "20159.139\n" == captured.out From 114310ed2d5692d2b28fe5a033b2ef84735af473 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:40:17 +0100 Subject: [PATCH 23/37] Create solution.hide.py --- exercises/08-Function-that-returns/solution.hide.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 exercises/08-Function-that-returns/solution.hide.py diff --git a/exercises/08-Function-that-returns/solution.hide.py b/exercises/08-Function-that-returns/solution.hide.py new file mode 100644 index 0000000..82ee742 --- /dev/null +++ b/exercises/08-Function-that-returns/solution.hide.py @@ -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) From 989a756e22cbb997f75894a7d9561cfd2fbb9736 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:50:56 +0100 Subject: [PATCH 24/37] Update README.md --- exercises/09-Function-parameters/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/09-Function-parameters/README.md b/exercises/09-Function-parameters/README.md index 1301c1a..d8a4321 100755 --- a/exercises/09-Function-parameters/README.md +++ b/exercises/09-Function-parameters/README.md @@ -6,18 +6,20 @@ tutorial: "https://www.youtube.com/watch?v=uaiDxW4LJNA" You can specify as many parameters as you want in a function. -As a developer you are going to find functions with even 6 or 7 parameters all the time. +As a developer, you are going to find functions with even 6 or 7 parameters all the time. The names of the parameters don't matter, but you have to be **as explicit as you can** because these names will give clues to the other developers (or yourself in the future) about what is each parameter about. ## 📝 Instructions: -1. Please write the `render_person` function required to print a a string like the following: +1. Please write the `render_person` function required to print a string like the following: -```py +```text Bob is a 23 years old male born in 05/22/1983 with green eyes ``` -## 💡 Hint +## 💡 Hints: + You have to do some string concatenation and return that string. + ++ Also, you can Google "how to insert variables into a string python". From cecf0db8be1200824fe3c0f7f172d168988d904d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:54:03 +0100 Subject: [PATCH 25/37] Update README.es.md --- exercises/09-Function-parameters/README.es.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/09-Function-parameters/README.es.md b/exercises/09-Function-parameters/README.es.md index 6500706..98c3c7d 100644 --- a/exercises/09-Function-parameters/README.es.md +++ b/exercises/09-Function-parameters/README.es.md @@ -1,4 +1,4 @@ -# `09` Parámetros de funciones +# `09` Function parameters Puedes especificar tantos parámetros como desees en una función. @@ -10,10 +10,12 @@ Los nombres de los parámetros no importan, pero debe ser **lo más explícito p + Escribe la función `render_person` requerida para imprimir un string como el siguiente: -```py +```text Bob is a 23 years old male born in 05/22/1983 with green eyes ``` -## 💡 Pista +## 💡 Pistas: -- Tienes que hacer una concatenación de string y devolver ese string. ++ Tienes que hacer una concatenación de string y devolver ese string. + ++ También, puedes buscar en Google "como insertar variables en un string python". From 71fe9b01f1c22db7b559d6274913d77225342191 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:57:29 +0100 Subject: [PATCH 26/37] Update solution.hide.py --- exercises/09-Function-parameters/solution.hide.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/09-Function-parameters/solution.hide.py b/exercises/09-Function-parameters/solution.hide.py index 71e6d5f..1b50585 100644 --- a/exercises/09-Function-parameters/solution.hide.py +++ b/exercises/09-Function-parameters/solution.hide.py @@ -1,7 +1,7 @@ # Your code goes here: -def render_person(name, birthdate, eye_color, age, sex): - return name +" is a "+ str(age) +" years old " + sex +" born in " + birthdate + " with "+eye_color +" eyes" +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')) \ No newline at end of file +print(render_person('Bob', '05/22/1983', 'green', 23, 'male')) From af4d5fd3997409841f39089238d31f0b173ea764 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:59:05 +0100 Subject: [PATCH 27/37] Update README.es.md --- exercises/09-Function-parameters/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/09-Function-parameters/README.es.md b/exercises/09-Function-parameters/README.es.md index 98c3c7d..ca03d09 100644 --- a/exercises/09-Function-parameters/README.es.md +++ b/exercises/09-Function-parameters/README.es.md @@ -8,7 +8,7 @@ Los nombres de los parámetros no importan, pero debe ser **lo más explícito p ## 📝 Instrucciones: -+ Escribe la función `render_person` requerida para imprimir un string como el siguiente: +1. Escribe la función `render_person` requerida para imprimir un string como el siguiente: ```text Bob is a 23 years old male born in 05/22/1983 with green eyes From 91c9d46426d430b76e4c84280ad6ca4ffec0dfd6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:05:01 +0100 Subject: [PATCH 28/37] Update README.md --- exercises/10-Array-Methods/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/exercises/10-Array-Methods/README.md b/exercises/10-Array-Methods/README.md index 26cc991..950a653 100755 --- a/exercises/10-Array-Methods/README.md +++ b/exercises/10-Array-Methods/README.md @@ -2,16 +2,15 @@ tutorial: "https://www.youtube.com/watch?v=jBXve_vh7dU" --- - # `10` List Methods ## 📝 Instructions: 1. Write a function called `sort_names` that, given a list of names, returns them in alphabetical order. -## 💡 Hint +## 💡 Hints: -+ Every list comes with default functions that allows sorting- use it inside your function! ++ Every list comes with default functions that allow sorting - use it inside your function! + Stuck on sorting? Read W3 Schools page on sorting lists: From a5eafd979df694a429b62f8a0b9ae9fe83c63632 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:06:55 +0100 Subject: [PATCH 29/37] Update README.md --- exercises/10-Array-Methods/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/10-Array-Methods/README.md b/exercises/10-Array-Methods/README.md index 950a653..0a53c67 100755 --- a/exercises/10-Array-Methods/README.md +++ b/exercises/10-Array-Methods/README.md @@ -12,6 +12,6 @@ tutorial: "https://www.youtube.com/watch?v=jBXve_vh7dU" + Every list comes with default functions that allow sorting - use it inside your function! -+ Stuck on sorting? Read W3 Schools page on sorting lists: ++ Stuck on sorting? Read the W3 Schools page on sorting lists: https://www.w3schools.com/python/ref_list_sort.asp From 3f6d9975200b60bd1d467befc57d07f5baddb79f Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:07:23 +0100 Subject: [PATCH 30/37] Update README.md --- exercises/10-Array-Methods/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/10-Array-Methods/README.md b/exercises/10-Array-Methods/README.md index 0a53c67..e91d7f6 100755 --- a/exercises/10-Array-Methods/README.md +++ b/exercises/10-Array-Methods/README.md @@ -10,7 +10,7 @@ tutorial: "https://www.youtube.com/watch?v=jBXve_vh7dU" ## 💡 Hints: -+ Every list comes with default functions that allow sorting - use it inside your function! ++ Every list comes with default functions that allow sorting - use them inside your function! + Stuck on sorting? Read the W3 Schools page on sorting lists: From 8bfd0bc73f4c52fd7272e60a0cb0932bc59eace6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:08:21 +0100 Subject: [PATCH 31/37] Update README.es.md --- exercises/10-Array-Methods/README.es.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/10-Array-Methods/README.es.md b/exercises/10-Array-Methods/README.es.md index 938c2ad..1c2810b 100644 --- a/exercises/10-Array-Methods/README.es.md +++ b/exercises/10-Array-Methods/README.es.md @@ -1,13 +1,13 @@ -# `10` Métodos de listas +# `10` List Methods ## 📝 Instrucciones: 1. Escribe una función llamada `sort_names` que dada una lista de nombres, los devuelva en orden alfabético. -## 💡 Pista: +## 💡 Pistas: -- Cada lista viene con funciones predeterminadas que permiten ordenarla ¡úsalas dentro de tu función! +- Cada lista viene con funciones predeterminadas que permiten ordenarla, ¡úsalas dentro de tu función! -+ ¿Atrapado en el orden? Lee esta página sobre cómo ordenar listas: ++ ¿Atascado? Lee esta página sobre cómo ordenar listas: -https://www.freecodecamp.org/espanol/news/python-ordenar-lista-con-sort-ascendente-y-descendente-explicado-con-ejemplos/ \ No newline at end of file +https://www.freecodecamp.org/espanol/news/python-ordenar-lista-con-sort-ascendente-y-descendente-explicado-con-ejemplos/ From 4b35a989b4ef58c93b5e89ea59a7e8fe8e02c566 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:09:39 +0100 Subject: [PATCH 32/37] Update solution.hide.py --- exercises/10-Array-Methods/solution.hide.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/exercises/10-Array-Methods/solution.hide.py b/exercises/10-Array-Methods/solution.hide.py index f63fbd8..37e6930 100644 --- a/exercises/10-Array-Methods/solution.hide.py +++ b/exercises/10-Array-Methods/solution.hide.py @@ -1,2 +1,8 @@ +names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan'] + +## CREATE YOUR FUNCTION HERE def sort_names (arr): return sorted(arr) + + +print(sort_names(names)) From 3c028564a1de7425bf2b620f849056ce0d60bf4d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:09:58 +0100 Subject: [PATCH 33/37] Update app.py --- exercises/10-Array-Methods/app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exercises/10-Array-Methods/app.py b/exercises/10-Array-Methods/app.py index c88bc18..9d60f6b 100755 --- a/exercises/10-Array-Methods/app.py +++ b/exercises/10-Array-Methods/app.py @@ -1,4 +1,6 @@ names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan'] + ## CREATE YOUR FUNCTION HERE + print(sort_names(names)) From a229f3077e4236663d6575335f7a54349e036f9b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:12:27 +0100 Subject: [PATCH 34/37] Update README.md --- exercises/10-Array-Methods/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/10-Array-Methods/README.md b/exercises/10-Array-Methods/README.md index e91d7f6..69316e3 100755 --- a/exercises/10-Array-Methods/README.md +++ b/exercises/10-Array-Methods/README.md @@ -14,4 +14,4 @@ tutorial: "https://www.youtube.com/watch?v=jBXve_vh7dU" + Stuck on sorting? Read the W3 Schools page on sorting lists: -https://www.w3schools.com/python/ref_list_sort.asp +https://www.w3schools.com/python/ref_func_sorted.asp From 355a13aeea30635a19c52a1ad7e40609b0a7910a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:13:43 +0100 Subject: [PATCH 35/37] Update tests.py --- exercises/10-Array-Methods/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/10-Array-Methods/tests.py b/exercises/10-Array-Methods/tests.py index 76a6c4d..5cce1e5 100755 --- a/exercises/10-Array-Methods/tests.py +++ b/exercises/10-Array-Methods/tests.py @@ -1,6 +1,6 @@ import io, sys, pytest, os, re, mock -@pytest.mark.it("Declare the function sort_names") +@pytest.mark.it("Declare the function 'sort_names'") def test_declare_variable(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: @@ -13,7 +13,7 @@ def test_declare_variable(): def test_for_functon_existence(capsys, app): assert callable(app.sort_names) -@pytest.mark.it('The function sort_names must accept 1 parameter and return a sorted one') +@pytest.mark.it('The function sort_names must accept a list and return a sorted one') def test_for_file_output(capsys): import app captured = capsys.readouterr() From b681c43699d487c4100e8e0a01b886a55c7d5d44 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:17:33 +0100 Subject: [PATCH 36/37] Update README.md --- exercises/07-lambda-function-two/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/07-lambda-function-two/README.md b/exercises/07-lambda-function-two/README.md index dcad70e..8796c77 100755 --- a/exercises/07-lambda-function-two/README.md +++ b/exercises/07-lambda-function-two/README.md @@ -9,8 +9,8 @@ tutorial: "https://www.youtube.com/watch?v=1HwmTkQPeMo" Lambda functions allow a short syntax for writing function expressions. ```python -multi = lambda x, y: x * y -print(multi(2,2)) +multiply = lambda x, y: x * y +print(multiply(2,2)) ``` ## 📝 Instructions: From a43808123104b2e57d780570c9f81db70f8c5ff5 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:17:44 +0100 Subject: [PATCH 37/37] Update README.es.md --- exercises/07-lambda-function-two/README.es.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/07-lambda-function-two/README.es.md b/exercises/07-lambda-function-two/README.es.md index 53c054e..c85e631 100644 --- a/exercises/07-lambda-function-two/README.es.md +++ b/exercises/07-lambda-function-two/README.es.md @@ -5,8 +5,8 @@ Las funciones Lambda permiten una sintaxis corta para escribir expresiones de funciones. ```python -multi = lambda x, y: x * y -print(multi(2,2)) +multiply = lambda x, y: x * y +print(multiply(2,2)) ``` ## 📝 Instrucciones: