From 95937fedfbd0c7ee7f556cbcf8417e2a10b7b73c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 19:38:36 +0100 Subject: [PATCH 01/23] Update README.md --- exercises/01-hello-world/README.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/exercises/01-hello-world/README.md b/exercises/01-hello-world/README.md index c9a83c8..30cf49b 100644 --- a/exercises/01-hello-world/README.md +++ b/exercises/01-hello-world/README.md @@ -2,32 +2,30 @@ intro: "https://www.youtube.com/watch?v=awa_yfGgy9s" --- -# Learn Python Functions! +# Welcome to Python Functions! We are very excited to have you here !! 🎉 😂 -Click `next` on the top right of this instructions when you are ready to start. +Click `next` on the top right of these instructions when you are ready to start. -During this course you will be learning the following concepts: +During this course, you will be learning the following concepts: -1. Learning how to create and call **functions.*** +1. Learning how to create and call functions. -2. Building your first real **functions** +2. Building your first real functions. -3. Get comfortable using Python **Lambda Functions** +3. Get comfortable using Python Lambda Functions. -4. Construct **functions** with parameters. +4. Construct functions with parameters. -5. Real life examples for **functions** +5. Real life examples for functions. ## Contributors Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): -1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) :computer: (idea) 🤔, (build-tests) :warning:, (pull-request-review) :eyes: (build-tutorial) :white_check_mark: (documentation) :book: -2. [Paolo (plucodev)](https://github.com/plucodev), contribution: (bug reports) :bug:, contribution: (coder), (translation) :earth_americas: -3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribution: (bug reports) :bug:, (translation) :earth_africa: +1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻 (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 🤓, (build-tutorial) ✅, (documentation) 📖 +2. [Paolo (plucodev)](https://github.com/plucodev), contribution: (bug reports) 🐛, (coder) 💻, (translation) 🌎 +3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribution: (bug reports) 🐛, (translation) 🌎 -This project follows the -[all-contributors](https://github.com/kentcdodds/all-contributors) -specification. Contributions of any kind are welcome! +This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome! From d4cd0b8db591e04198b011af93e38651c9f35be2 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:02:26 +0100 Subject: [PATCH 02/23] Update README.md --- exercises/01-hello-world/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/01-hello-world/README.md b/exercises/01-hello-world/README.md index 30cf49b..5522b4b 100644 --- a/exercises/01-hello-world/README.md +++ b/exercises/01-hello-world/README.md @@ -6,7 +6,7 @@ intro: "https://www.youtube.com/watch?v=awa_yfGgy9s" We are very excited to have you here !! 🎉 😂 -Click `next` on the top right of these instructions when you are ready to start. +Click `Next →` on the top right of these instructions when you are ready to start. During this course, you will be learning the following concepts: @@ -24,7 +24,7 @@ During this course, you will be learning the following concepts: Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): -1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻 (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 🤓, (build-tutorial) ✅, (documentation) 📖 +1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 🤓, (build-tutorial) ✅, (documentation) 📖 2. [Paolo (plucodev)](https://github.com/plucodev), contribution: (bug reports) 🐛, (coder) 💻, (translation) 🌎 3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribution: (bug reports) 🐛, (translation) 🌎 From 86ba89b902166db27cae9e85a57ca0d9eebcb12b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:02:30 +0100 Subject: [PATCH 03/23] Update README.es.md --- exercises/01-hello-world/README.es.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/exercises/01-hello-world/README.es.md b/exercises/01-hello-world/README.es.md index 7f288fa..82f48a5 100644 --- a/exercises/01-hello-world/README.es.md +++ b/exercises/01-hello-world/README.es.md @@ -1,29 +1,27 @@ -# Aprende Funciones en Python! +# Welcome to Python Functions! -¡¡Nos estusiasma mucho tenerte aquí!! 🎉 😂 +¡¡Nos entusiasma mucho tenerte aquí!! 🎉 😂 Presiona `Next →` en la esquina superior derecha cuando quieras empezar. En este curso aprenderás los siguientes conceptos: -1. Cómo crear y llamar **funciones.** +1. Cómo crear y llamar funciones. -2. Construir tus primeras **funciones.** +2. Construir tus primeras funciones. -3. Sentirte cómod@ usando **funciones Lambda** en Python. +3. Practicar las funciones Lambda de Python. -4. Construir **funciones** con parámetros. +4. Construir funciones con parámetros. -5. Ejemplos de la vida real con **funciones** +5. Ejemplos de la vida real con funciones. ## Contributors Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): -1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) :computer: (idea) 🤔, (build-tests) :warning:, (pull-request-review) :eyes: (build-tutorial) :white_check_mark: (documentation) :book: -2. [Paolo (plucodev)](https://github.com/plucodev), contribución: (bug reports) :bug: (coder) :computer:, (traducción) :earth_americas: -3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribución: (bug reports) :bug:, (traducción) :earth_africa: +1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 🤓, (build-tutorial) ✅, (documentation) 📖 +2. [Paolo (plucodev)](https://github.com/plucodev), contribución: (bug reports) 🐛, (coder) 💻, (traducción) 🌎 +3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribución: (bug reports) 🐛, (traducción) 🌎 -This project follows the -[all-contributors](https://github.com/kentcdodds/all-contributors) -specification. Contributions of any kind are welcome! +This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome! From 185c68ca1badabaf2352bbb7033c7df44f57dff4 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:12:56 +0100 Subject: [PATCH 04/23] Update README.md --- exercises/02-Hello-World/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/02-Hello-World/README.md b/exercises/02-Hello-World/README.md index 99bb08f..826f3ac 100644 --- a/exercises/02-Hello-World/README.md +++ b/exercises/02-Hello-World/README.md @@ -4,22 +4,22 @@ tutorial: "https://www.youtube.com/watch?v=voBO7a0KPtE" # `02` Hello World -In Python, we use `print` to make the computer write anything we want (the content of a variable, a given string, etc.) in something called `the console`. +In Python, we use `print` to make the computer write anything we want (the content of a variable, a given string, etc.) in something called "the console". -Every language has **functions** to integrate with the console, as it was the only way to interact with the users at the beginning (before the Windows or Linux or MacOS arrived). +Every language has **functions** to integrate with the console, as it was the only way to interact with the users at the beginning (before Windows, Linux or macOS arrived). -Today, printing in the console is used mostly as a monitoring tool, ideal to leave a trace of the content of variables during the program execution. +Today, printing in the console is mostly used as a monitoring and debugging tool, ideal for leaving a trace of the content of variables during the program's execution. This is an example of how to use it: + ```py print("How are you?") ``` ## 📝 Instructions: -1. Use `print` to display `"Hello World"` on the console. Feel free to try other things as well. +1. Use `print()` to display `"Hello World"` on the console. Feel free to try other things as well. ## 💡 Hint: -+ :video_camera: You can watch this 5 minutes video about the console: -https://www.youtube.com/watch?v=vROGBvX_MHQ ++ 📹 You can watch this 2 minute video about the console: https://www.youtube.com/watch?v=vROGBvX_MHQ From 849627ea920fcf13f7916e67be6e23fe8db7e93d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:14:19 +0100 Subject: [PATCH 05/23] Update README.md --- exercises/02-Hello-World/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/02-Hello-World/README.md b/exercises/02-Hello-World/README.md index 826f3ac..25b59bc 100644 --- a/exercises/02-Hello-World/README.md +++ b/exercises/02-Hello-World/README.md @@ -4,7 +4,7 @@ tutorial: "https://www.youtube.com/watch?v=voBO7a0KPtE" # `02` Hello World -In Python, we use `print` to make the computer write anything we want (the content of a variable, a given string, etc.) in something called "the console". +In Python, we use **print** to make the computer write anything we want (the content of a variable, a given string, etc.) in something called "the console". Every language has **functions** to integrate with the console, as it was the only way to interact with the users at the beginning (before Windows, Linux or macOS arrived). From c8d874ba716f90c16b4348818bf5cb3404f4775a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:17:58 +0100 Subject: [PATCH 06/23] Update README.es.md --- exercises/02-Hello-World/README.es.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/exercises/02-Hello-World/README.es.md b/exercises/02-Hello-World/README.es.md index 0e91c64..c27cad8 100644 --- a/exercises/02-Hello-World/README.es.md +++ b/exercises/02-Hello-World/README.es.md @@ -1,10 +1,12 @@ # `02` Hello World -En Python, usamos `print` para hacer que el computador escriba cualquier cosa que queramos (el contenido de una variable, un texto dado, etc.) en algo llamado `la consola`. +En Python, usamos **print** para hacer que el computador escriba cualquier cosa que queramos (el contenido de una variable, un string dado, etc.) en algo llamado "la consola". -Cada idioma tiene **funciones** para integrarse con la consola, ya que al principio era la única forma de interactuar con los usuarios (antes de que llegara Windows o MacOS o Linux). Hoy en día, la impresión en la consola se utiliza (`print`) sobre todo como herramienta de monitoreo, ideal para dejar un rastro del contenido de las variables durante la ejecución del programa. +Cada lenguaje tiene **funciones** para integrarse con la consola, ya que al principio era la única forma de interactuar con los usuarios (antes de que llegaran Windows, Linux o macOS) -Este es un ejemplo de cómo usarlo +Hoy en día, la impresión en la consola se utiliza, sobre todo, como herramienta de monitoreo y depuración, ideal para dejar un rastro del contenido de las variables durante la ejecución del programa. + +Este es un ejemplo de cómo usarla: ```py print("How are you?") @@ -16,5 +18,4 @@ print("How are you?") ## 💡 Pista: -+ :video_camera: Puedes ver este breve video (5 minutos) sobre la consola: -https://www.youtube.com/watch?v=vROGBvX_MHQ ++ 📹 Puedes ver este breve video (2 minutos) sobre la consola: https://www.youtube.com/watch?v=vROGBvX_MHQ From fc6cc2cfc9cf9d9dcd78fd4310bbadd977e181eb Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:18:22 +0100 Subject: [PATCH 07/23] Update README.es.md --- exercises/02-Hello-World/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/02-Hello-World/README.es.md b/exercises/02-Hello-World/README.es.md index c27cad8..2ebad83 100644 --- a/exercises/02-Hello-World/README.es.md +++ b/exercises/02-Hello-World/README.es.md @@ -2,7 +2,7 @@ En Python, usamos **print** para hacer que el computador escriba cualquier cosa que queramos (el contenido de una variable, un string dado, etc.) en algo llamado "la consola". -Cada lenguaje tiene **funciones** para integrarse con la consola, ya que al principio era la única forma de interactuar con los usuarios (antes de que llegaran Windows, Linux o macOS) +Cada lenguaje tiene **funciones** para integrarse con la consola, ya que al principio era la única forma de interactuar con los usuarios (antes de que llegaran Windows, Linux o macOS). Hoy en día, la impresión en la consola se utiliza, sobre todo, como herramienta de monitoreo y depuración, ideal para dejar un rastro del contenido de las variables durante la ejecución del programa. From bc3b37086a48cda33fc66c5a46600dd7a0489108 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:18:37 +0100 Subject: [PATCH 08/23] Update app.py --- exercises/02-Hello-World/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/02-Hello-World/app.py b/exercises/02-Hello-World/app.py index 801de24..fce62c1 100644 --- a/exercises/02-Hello-World/app.py +++ b/exercises/02-Hello-World/app.py @@ -1 +1 @@ -# your code here \ No newline at end of file +# Your code here From ea6a0e2b6548519be2d7e655c7ebb8ee83a73d78 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:19:47 +0100 Subject: [PATCH 09/23] Create solution.hide.py --- exercises/02-Hello-World/solution.hide.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 exercises/02-Hello-World/solution.hide.py diff --git a/exercises/02-Hello-World/solution.hide.py b/exercises/02-Hello-World/solution.hide.py new file mode 100644 index 0000000..84d3ce7 --- /dev/null +++ b/exercises/02-Hello-World/solution.hide.py @@ -0,0 +1,3 @@ +# Your code here + +print("Hello World!") From d893571d2a66b03c879a62931cf7b2e35894c4ea Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:19:58 +0100 Subject: [PATCH 10/23] Update solution.hide.py --- exercises/02-Hello-World/solution.hide.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/02-Hello-World/solution.hide.py b/exercises/02-Hello-World/solution.hide.py index 84d3ce7..a033754 100644 --- a/exercises/02-Hello-World/solution.hide.py +++ b/exercises/02-Hello-World/solution.hide.py @@ -1,3 +1,3 @@ # Your code here -print("Hello World!") +print("Hello World") From 16d9038149e6071d897352b116c01f6efc5260da Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:27:14 +0100 Subject: [PATCH 11/23] Update README.md --- exercises/03-What-is-a-function/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/03-What-is-a-function/README.md b/exercises/03-What-is-a-function/README.md index 7f2a283..6d3dab9 100755 --- a/exercises/03-What-is-a-function/README.md +++ b/exercises/03-What-is-a-function/README.md @@ -10,19 +10,19 @@ For example: If we want to get the sum of two numbers, we can declare a function ```python def sum(number1,number2): - return number1 + number2 + return number1 + number2 ``` -After the function is declared we can use it as many times as we want, like this: +After the function is declared, we can use it as many times as we want, like this: ```python total = sum(2,3) total2 = sum(5,10) -print(total) # prints 5 on the console -print(total2) # prints 15 on the console +print(total) # Prints 5 on the console +print(total2) # Prints 15 on the console ``` -# 📝 Instructions +## 📝 Instructions: -1. Please calculate the sum between **3445324** and **53454423** and assign the result to a variable called `super_duper` +1. Please calculate the sum between `3445324` and `53454423` and assign the result to a variable called `super_duper` From 1a1fec3cbc33079eac311fc7120bb6b8777fd3a7 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:29:04 +0100 Subject: [PATCH 12/23] Update README.md --- exercises/03-What-is-a-function/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/03-What-is-a-function/README.md b/exercises/03-What-is-a-function/README.md index 6d3dab9..4f00844 100755 --- a/exercises/03-What-is-a-function/README.md +++ b/exercises/03-What-is-a-function/README.md @@ -25,4 +25,4 @@ print(total2) # Prints 15 on the console ## 📝 Instructions: -1. Please calculate the sum between `3445324` and `53454423` and assign the result to a variable called `super_duper` +1. Please calculate the sum between `3445324` and `53454423` and assign the result to a variable called `super_duper`. From 3d4a1141f42e37d28f53af10aaa6072879984dfc Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:29:23 +0100 Subject: [PATCH 13/23] Update README.es.md --- exercises/03-What-is-a-function/README.es.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exercises/03-What-is-a-function/README.es.md b/exercises/03-What-is-a-function/README.es.md index 93e8ee9..e1de4ff 100644 --- a/exercises/03-What-is-a-function/README.es.md +++ b/exercises/03-What-is-a-function/README.es.md @@ -1,12 +1,12 @@ -# `03` ¿Qué es una función (function)? +# `03` What is a function? -Puedes ver una función como un **fragmento de código** que puedes encapsular entre llaves para poder usarla varias veces. +Puedes ver una función como un **fragmento de código** que puedes usar varias veces. Por ejemplo, si queremos obtener la suma de dos números, podemos declarar una función llamada `sum` que devuelve la suma de `number1` y `number2`: ```python def sum(number1,number2): - return number1 + number2 + return number1 + number2 ``` Después de declarar la función, podemos usarla tantas veces como queramos, así: @@ -15,10 +15,10 @@ Después de declarar la función, podemos usarla tantas veces como queramos, as total = sum(2,3) total2 = sum(5,10) -print(total) # imprime 5 en la consola -print(total2) # imprime 15 en la consola +print(total) # Imprime 5 en la consola +print(total2) # Imprime 15 en la consola ``` -# 📝 Instrucciones +## 📝 Instrucciones: -1. Calcula la suma entre **3445324** y **53454423** y asigna el resultado a una variable llamada `super_duper` +1. Calcula la suma entre `3445324` y `53454423` y asigna el resultado a una variable llamada `super_duper`. From 1684f5886515adc5c82a26ead61cd47a374e7cfe Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:34:16 +0100 Subject: [PATCH 14/23] Create solution.hide.py --- exercises/03-What-is-a-function/solution.hide.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 exercises/03-What-is-a-function/solution.hide.py diff --git a/exercises/03-What-is-a-function/solution.hide.py b/exercises/03-What-is-a-function/solution.hide.py new file mode 100644 index 0000000..a313431 --- /dev/null +++ b/exercises/03-What-is-a-function/solution.hide.py @@ -0,0 +1,6 @@ +def sum(number1,number2): + return number1 + number2 + +# Your code here +super_duper = sum(3445324,53454423) +print(super_duper) From 6040cfdb03544595cd2cf002e3d0e163a573319e Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:34:22 +0100 Subject: [PATCH 15/23] Update app.py --- exercises/03-What-is-a-function/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/03-What-is-a-function/app.py b/exercises/03-What-is-a-function/app.py index daa9ff3..efeec63 100755 --- a/exercises/03-What-is-a-function/app.py +++ b/exercises/03-What-is-a-function/app.py @@ -1,5 +1,6 @@ def sum(number1,number2): return number1 + number2 +# Your code here total = sum(2,3) print(total) From c0891c6b5a8e7371663f7143a485990197fcee02 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:46:52 +0100 Subject: [PATCH 16/23] Update README.md --- exercises/04-Call-a-function/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/04-Call-a-function/README.md b/exercises/04-Call-a-function/README.md index f26383c..f8ecbed 100755 --- a/exercises/04-Call-a-function/README.md +++ b/exercises/04-Call-a-function/README.md @@ -2,47 +2,47 @@ tutorial: "https://www.youtube.com/watch?v=NU5iW_bWwmY" --- -# `04` Calling a function +# `04` Calling a Function A function could receive zero parameters, and it always returns something, even if you don't explicitly add the `return` statement. -:point_up: [Click here to read more about functions](https://content.breatheco.de/lesson/working-with-functions-python) +👉 [Click here to read more about functions](https://content.breatheco.de/lesson/working-with-functions-python) For example: a function that calculates the area of a square will be something like this: ```python -def calculate_area(length, edge): - return length * edge +def calculate_area(length, width): + return length * width ``` If you want to use that function to calculate the area of a square with: ```python length = 3 -edge = 6 +width = 6 ``` You need to do something like this: ```python area = calculate_area(3,6) -# The value of area will be set to 18 +# The value of 'area' will be set to 18 ``` ## 📝 Instructions: -1. Create a new variables named `square_area1`, `square_area2`, `square_area3` and call the function `calculate_area` three times one for each square in the picture, for example: +1. Create new variables named `square_area1`, `square_area2`, `square_area3` and call the function `calculate_area` three times, one for each square in the picture, for example: ```python # For the first figure: square_area1 = calculate_area(4,4) ``` -![img](http://i.imgur.com/VyoJRAL.png) +![squares](http://i.imgur.com/VyoJRAL.png) -## 💡 Hint: +## 💡 Hints: + Call the `calculate_area` function three times, one per each square, passing the length and edge of each square. -+ :video_camera: [9 min video about functions in python](https://www.youtube.com/watch?v=NE97ylAnrz4) ++ 📹 [9 min video about functions in Python](https://www.youtube.com/watch?v=NE97ylAnrz4). From c822158e738d2f33464f3dadd2cc1891b9d3c3cb Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:49:24 +0100 Subject: [PATCH 17/23] Update README.md --- exercises/04-Call-a-function/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/04-Call-a-function/README.md b/exercises/04-Call-a-function/README.md index f8ecbed..655e98d 100755 --- a/exercises/04-Call-a-function/README.md +++ b/exercises/04-Call-a-function/README.md @@ -6,7 +6,7 @@ tutorial: "https://www.youtube.com/watch?v=NU5iW_bWwmY" A function could receive zero parameters, and it always returns something, even if you don't explicitly add the `return` statement. -👉 [Click here to read more about functions](https://content.breatheco.de/lesson/working-with-functions-python) +👉 [Click here to read more about functions](https://content.breatheco.de/lesson/working-with-functions-python). For example: a function that calculates the area of a square will be something like this: From 42fffeedd371fd65a8f558a2d4b164fbc9612605 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:49:58 +0100 Subject: [PATCH 18/23] Update README.md --- exercises/04-Call-a-function/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/04-Call-a-function/README.md b/exercises/04-Call-a-function/README.md index 655e98d..a0a8bee 100755 --- a/exercises/04-Call-a-function/README.md +++ b/exercises/04-Call-a-function/README.md @@ -6,7 +6,7 @@ tutorial: "https://www.youtube.com/watch?v=NU5iW_bWwmY" A function could receive zero parameters, and it always returns something, even if you don't explicitly add the `return` statement. -👉 [Click here to read more about functions](https://content.breatheco.de/lesson/working-with-functions-python). +👉 [Click here to read more about functions](https://4geeks.com/lesson/working-with-functions-python). For example: a function that calculates the area of a square will be something like this: From 2da7f65dd185a0476d985e5aa31ce70d3e8dee6e Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:51:46 +0100 Subject: [PATCH 19/23] Update README.md --- exercises/04-Call-a-function/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/04-Call-a-function/README.md b/exercises/04-Call-a-function/README.md index a0a8bee..58e957f 100755 --- a/exercises/04-Call-a-function/README.md +++ b/exercises/04-Call-a-function/README.md @@ -38,7 +38,7 @@ area = calculate_area(3,6) square_area1 = calculate_area(4,4) ``` -![squares](http://i.imgur.com/VyoJRAL.png) +![Squares](http://i.imgur.com/VyoJRAL.png) ## 💡 Hints: From 772e9e5ab91c2b630b007869aa3b826b2eb5e437 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:53:20 +0100 Subject: [PATCH 20/23] Update README.es.md --- exercises/04-Call-a-function/README.es.md | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/exercises/04-Call-a-function/README.es.md b/exercises/04-Call-a-function/README.es.md index e04cd13..ae2c760 100644 --- a/exercises/04-Call-a-function/README.es.md +++ b/exercises/04-Call-a-function/README.es.md @@ -1,46 +1,46 @@ --- tutorial: "https://www.youtube.com/watch?v=NU5iW_bWwmY" --- -# `04` Llamando a una función +# `04` Calling a Function -Una función podría recibir 0 parámetros y tú puedes devolver algo siempre, incluso si no añades explícitamente el `return`. +Una función podría recibir 0 parámetros y devolverá algo siempre, incluso si no añades explícitamente el `return`. -:point_up: [Presiona aquí para saber más sobre funciones](https://content.breatheco.de/es/lesson/working-with-functions-python/) +👉 [Clic aquí para saber más sobre funciones](https://4geeks.com/es/lesson/working-with-functions-python-es). Por ejemplo, una función que calcula el área de un cuadrado sería algo como esto: ```python -def calculate_area(length, edge): - return length * edge +def calculate_area(length, width): + return length * width ``` -Si deseas usar esa función para calcular el área de un cuadrado con +Si deseas usar esa función para calcular el área de un cuadrado con: ```python length = 3 -edge = 6 +width = 6 ``` Tendrías que hacer algo como esto: ```python area = calculate_area(3,6) -# El valor del área es 18 +# El valor de 'area' sería 18 ``` ## 📝 Instrucciones: -1. Crea nuevas variables llamadas `squareArea1`, `square_area2`, `square_area3` y llama a la función `CalculateArea` 3 veces, un por cada cuadrado en la foto, utilizando las dimensiones de la figura, por ejemplo: +1. Crea nuevas variables llamadas `square_area1`, `square_area2`, `square_area3` y llama a la función `calculate_area` 3 veces, una por cada cuadrado en la foto, utilizando las dimensiones de la figura, por ejemplo: ```python -# para la primera figura: +# Para la primera figura: square_area1 = calculate_area(4,4) ``` -![img](http://i.imgur.com/VyoJRAL.png) +![Cuadrados](http://i.imgur.com/VyoJRAL.png) -## 💡 Pista: +## 💡 Pistas: -- Llama 3 veces a la función `calculate_area`, una por cada cuadrado, pasando la longitud y el borde de cada cuadrado. +- Llama 3 veces a la función `calculate_area`, una por cada cuadrado, pasando la longitud y el ancho de cada cuadrado. -+ :video_camera: [Video de 9 min sobre funciones en Python](https://www.youtube.com/watch?v=NE97ylAnrz4) ++ 📹 [Video de 9 min sobre funciones en Python](https://www.youtube.com/watch?v=NE97ylAnrz4). From 0b953a04cf4bf6d638b0fca22cdce03e4c1ace00 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:54:11 +0100 Subject: [PATCH 21/23] Update app.py --- exercises/04-Call-a-function/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/04-Call-a-function/app.py b/exercises/04-Call-a-function/app.py index c856d48..0c131b3 100755 --- a/exercises/04-Call-a-function/app.py +++ b/exercises/04-Call-a-function/app.py @@ -1,4 +1,4 @@ -def calculate_area(length,edge): - return length * edge +def calculate_area(length, width): + return length * width -# Your code Below this line: \ No newline at end of file +# Your code below this line From 9a62da1023f42a9c460cbec66ec6d3f0fa7cdda5 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:54:28 +0100 Subject: [PATCH 22/23] Update solution.hide.py --- exercises/04-Call-a-function/solution.hide.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/04-Call-a-function/solution.hide.py b/exercises/04-Call-a-function/solution.hide.py index d02eb4a..758b6e6 100644 --- a/exercises/04-Call-a-function/solution.hide.py +++ b/exercises/04-Call-a-function/solution.hide.py @@ -1,7 +1,7 @@ -def calculate_area(length,edge): - return length * edge +def calculate_area(length, width): + return length * width -# Your code Below this line: +# Your code below this line square_area1 = calculate_area(4,4) square_area2 = calculate_area(2,2) -square_area3 = calculate_area(5,5) \ No newline at end of file +square_area3 = calculate_area(5,5) From bc85b6558f504e99919af2b7e41d44a3e7ce74e4 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:57:12 +0100 Subject: [PATCH 23/23] Update tests.py --- exercises/04-Call-a-function/tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/04-Call-a-function/tests.py b/exercises/04-Call-a-function/tests.py index 52dc7d3..3657291 100755 --- a/exercises/04-Call-a-function/tests.py +++ b/exercises/04-Call-a-function/tests.py @@ -1,6 +1,6 @@ import io, sys, pytest, os, re, mock -@pytest.mark.it("Create a function 'calculate_area'") +@pytest.mark.it("Create the function 'calculate_area'") def test_declare_variable(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: @@ -16,7 +16,7 @@ def test_for_callable(capsys, app): def test_for_integer(capsys, app): assert isinstance(app.calculate_area(3,4), int) -@pytest.mark.it('We tried the function sum with a=3 and b=4 and it did not return 7') +@pytest.mark.it('We tried the function sum with length=3 and width=4 and it did not return 12') def test_for_return(capsys, app): assert app.calculate_area(3,4) == 12 assert app.calculate_area(5,4) == 20 @@ -43,10 +43,10 @@ def test_for_square_area_value2(capsys, app): def test_for_square_area_value3(capsys, app): assert app.square_area3 == 25 -@pytest.mark.it("Create a function calculate_area must be called 3 times, one for each figure") +@pytest.mark.it("The function calculate_area must be called 3 times, one for each square") def test_call_calculate_area(): path = os.path.dirname(os.path.abspath(__file__))+'/app.py' with open(path, 'r') as content_file: content = content_file.read() regex = re.compile(r"=(\s*)calculate_area\s*\(") - assert bool(regex.search(content)) == True \ No newline at end of file + assert bool(regex.search(content)) == True