diff --git a/exercises/01-Console/README.es.md b/exercises/01-Console/README.es.md index 9fa8019d..0b009142 100644 --- a/exercises/01-Console/README.es.md +++ b/exercises/01-Console/README.es.md @@ -2,7 +2,7 @@ En Python, usamos **print** para que el computador escriba cualquier cosa que queramos (el contenido de una variable, una string dado, etc.) en algo llamado "la consola". -Cada lenguaje tiene una consola, ya que al principio era la única forma de interactuar con los usuarios (antes de que llegaran Windows, Linux o MacOS). +Cada lenguaje de programación tiene una 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. @@ -14,4 +14,12 @@ print("Un texto en la consola") ## 📝 Instrucciones: -1. usa **print** para escribir `Hello World!` en la consola. Siéntete libre de intentar otras cosas también. \ No newline at end of file +1. usa **print** para escribir `Hello World!` en la consola. + +## 💡 Pistas: + ++ Recuerda, para ejecutar el código y ver el resultado en la consola, haz clic en el ícono de caja en la esquina superior izquierda de la pantalla: + +https://i.imgur.com/w6u4aDd.png + ++ Siéntete libre de intentar otras cosas también. diff --git a/exercises/01-Console/README.md b/exercises/01-Console/README.md index 84b8b5c8..7483c0e8 100644 --- a/exercises/01-Console/README.md +++ b/exercises/01-Console/README.md @@ -6,7 +6,7 @@ tutorial: "https://www.youtube.com/watch?v=2sV-2frucUs" 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 a console, as it was the only way to interact with the users at the beginning (before Windows or MacOS arrived). +Every programming language has a console, as it was the only way to interact with the users at the beginning (before Windows or MacOS arrived). Today, printing in the console is used mostly as a monitoring and debugging tool, ideal to leave a trace of the content of variables during the program execution. @@ -18,4 +18,13 @@ print("How are you?") ## 📝 Instructions: -1. Use **print** to print `Hello World!` on the console. Feel free to try other things as well. \ No newline at end of file +1. Use **print** to print `Hello World!` on the console. + + +## 💡 Hints: + ++ Remember, to run the code and see the output on the console, click on the box icon in the top left of the screen: + +https://i.imgur.com/w6u4aDd.png + ++ Feel free to try other things as well. diff --git a/exercises/01-Console/test.py b/exercises/01-Console/test.py index a5d05484..63d4f7f0 100644 --- a/exercises/01-Console/test.py +++ b/exercises/01-Console/test.py @@ -19,5 +19,5 @@ def test_for_file_output(capsys): @pytest.mark.it('Print Hello World! on the console') def test_for_console_log(capsys): captured = buffer.getvalue() - assert captured == "Hello World!\n" #add \n because the console jumps the line on every print + assert "Hello World!\n" in captured #add \n because the console jumps the line on every print diff --git a/exercises/02-Declare-Variables/README.es.md b/exercises/02-Declare-Variables/README.es.md index f75de2d6..9954fc1c 100644 --- a/exercises/02-Declare-Variables/README.es.md +++ b/exercises/02-Declare-Variables/README.es.md @@ -1,17 +1,21 @@ # `02` Declare Variables -Las variables actúan como una caja (contenedor) que te permite almacenar distintos tipos de datos. Así es como se define una variable: +En la programación, usamos variables como si fueran cajas (o contenedores) para guardar diferentes tipos de información. Así es cómo creamos una variable: ```py name = "Daniel" ``` +En este ejemplo, `name` es la variable, actuando como una caja para almacenar el valor `"Daniel"`. Dentro de esta 'caja', estamos almacenando el valor `"Daniel"`, y podemos usar `name` para referirnos a este valor más tarde. Al nombrar tus variables, puedes elegir casi cualquier nombre, pero debe comenzar con una letra o un guión bajo (`_`). Es útil elegir un nombre que describa lo que hay dentro de la 'caja' para que puedas entender fácilmente lo que representa más adelante. + ## 📝 Instrucciones: -1. Declara una variable con el valor "Yellow" y luego imprímelo en la consola. +1. Declara una variable con el valor `"Yellow"` y luego imprímelo en la consola. 2. Luego, imprime su valor en la consola usando `print(name)`. ## 💡 Pista: + Puedes darle el nombre que quieras a la variable, pero su valor tiene que ser el texto "Yellow". + ++ Si necesitas más explicación sobre qué son los **strings** y cómo funcionan en Python, puedes ver este clip: https://www.youtube.com/watch?v=yT0jixU3M2c&ab_channel=ProgramaResuelto (`ctrl + click` en el enlance para abrir el video) diff --git a/exercises/02-Declare-Variables/README.md b/exercises/02-Declare-Variables/README.md index 2c7b1082..8d0bd5a6 100644 --- a/exercises/02-Declare-Variables/README.md +++ b/exercises/02-Declare-Variables/README.md @@ -4,18 +4,21 @@ tutorial: "https://www.youtube.com/watch?v=dWWvZkaPwDw" # `02` Declare Variables -Variables act as a box (container) that lets you store different types of data. This is how we set a variable: +In programming, we use variables like boxes (or containers) to store different kinds of information. Here's how to create a variable: ```py name = "Daniel" ``` +In this example, `name` is the variable, acting like a box to store the value `"Daniel"`. Inside this 'box', we're storing the value `"Daniel"`, and we can use `name` to refer to it later. When naming your variables, you can choose almost any name, but it must begin with a letter or an underscore (`_`). It's helpful to pick a name that describes what's inside the 'box' so you can easily understand what it represents later on. + ## 📝 Instructions: -1. Declare a new variable with the string value "Yellow" and print the value to the console. +1. Declare a new variable with the string value `"Yellow"` and print the value to the console. 2. Then, print its value on the console using `print(name)`. ## 💡 Hint: + The name of the variable can be whatever you want, but the value inside has to be the string "Yellow". ++ If you need further explanation on what **strings** are and how they work in python, you can watch this clip: https://youtube.com/clip/UgkxyQ_JLmgSUL4l25c8Ly7cCRvk1Gm-EchU (`ctrl + click` on the link to open the video) \ No newline at end of file diff --git a/exercises/02-Declare-Variables/app.py b/exercises/02-Declare-Variables/app.py index cfdfa83d..83e80593 100644 --- a/exercises/02-Declare-Variables/app.py +++ b/exercises/02-Declare-Variables/app.py @@ -1 +1 @@ -# your code here +# ✅ ↓ your code here ↓ ✅ diff --git a/exercises/02-Declare-Variables/solution.hide.py b/exercises/02-Declare-Variables/solution.hide.py index 52765b39..4c622518 100644 --- a/exercises/02-Declare-Variables/solution.hide.py +++ b/exercises/02-Declare-Variables/solution.hide.py @@ -1,4 +1,4 @@ -# your code here +# ✅ ↓ your code here ↓ ✅ color = "Yellow" print(color) \ No newline at end of file diff --git a/exercises/02-Declare-Variables/test.py b/exercises/02-Declare-Variables/test.py index e4ab65a3..4a41e117 100644 --- a/exercises/02-Declare-Variables/test.py +++ b/exercises/02-Declare-Variables/test.py @@ -27,6 +27,6 @@ def test_for_variable(): @pytest.mark.it('Print the variable on the console') def test_for_file_output(capsys): captured = buffer.getvalue() - assert captured == "Yellow\n" #add \n because the console jumps the line on every print + assert "Yellow\n" in captured #add \n because the console jumps the line on every print diff --git a/exercises/03-Print-Variables-In-The-Console/README.es.md b/exercises/03-Print-Variables-In-The-Console/README.es.md index 58018c25..cc1abed7 100644 --- a/exercises/03-Print-Variables-In-The-Console/README.es.md +++ b/exercises/03-Print-Variables-In-The-Console/README.es.md @@ -9,6 +9,6 @@ print(my_super_variable) ## 📝 Instrucciones: -1. Declara una nueva variable llamada `color` y asígnale el valor `red`. +1. Declara una nueva variable llamada `color` y asígnale el valor `"red"`. 2. Luego, imprime su valor en la consola (puede que tengas que desplazarte en la consola para poder verlo). diff --git a/exercises/03-Print-Variables-In-The-Console/README.md b/exercises/03-Print-Variables-In-The-Console/README.md index 88d36063..a2b28a89 100644 --- a/exercises/03-Print-Variables-In-The-Console/README.md +++ b/exercises/03-Print-Variables-In-The-Console/README.md @@ -13,6 +13,6 @@ print(my_super_variable) ## 📝 Instructions: -1. Declare a new variable called `color` and assign the value `red` to it. +1. Declare a new variable called `color` and assign the value `"red"` to it. 2. Then, print its value on the console (you may have to scroll up in the terminal to see it!). diff --git a/exercises/03-Print-Variables-In-The-Console/app.py b/exercises/03-Print-Variables-In-The-Console/app.py index e46f8386..f62f6922 100644 --- a/exercises/03-Print-Variables-In-The-Console/app.py +++ b/exercises/03-Print-Variables-In-The-Console/app.py @@ -1 +1 @@ -#your code here \ No newline at end of file +# ✅ ↓ your code here ↓ ✅ \ No newline at end of file diff --git a/exercises/03-Print-Variables-In-The-Console/solution.hide.py b/exercises/03-Print-Variables-In-The-Console/solution.hide.py index 63a8e60f..fe2615ac 100644 --- a/exercises/03-Print-Variables-In-The-Console/solution.hide.py +++ b/exercises/03-Print-Variables-In-The-Console/solution.hide.py @@ -1,4 +1,4 @@ -#your code here +# ✅ ↓ your code here ↓ ✅ color = "red" print(color) \ No newline at end of file diff --git a/exercises/03-Print-Variables-In-The-Console/test.py b/exercises/03-Print-Variables-In-The-Console/test.py index 103e649f..6dbe8c36 100644 --- a/exercises/03-Print-Variables-In-The-Console/test.py +++ b/exercises/03-Print-Variables-In-The-Console/test.py @@ -11,7 +11,7 @@ @pytest.mark.it("Create a variable named 'color' with the string value red") def test_declare_variable(): result = app.color - assert result == "red" + assert result == "red" @pytest.mark.it('Print on the console the value of the variable ') def test_for_printing_variable(): @@ -24,4 +24,4 @@ def test_for_printing_variable(): @pytest.mark.it('The printed value on the console should be "red"') def test_for_file_output(capsys): captured = buffer.getvalue() - assert captured == "red\n" \ No newline at end of file + assert "red\n" in captured \ No newline at end of file diff --git a/exercises/04-Multiply-Two-Values/README.md b/exercises/04-Multiply-Two-Values/README.md index 41cd9da0..3d50d029 100644 --- a/exercises/04-Multiply-Two-Values/README.md +++ b/exercises/04-Multiply-Two-Values/README.md @@ -12,7 +12,7 @@ To multiply 2 values in python, you have to use the asterisk operator like this: resulting_value = 2 * 3 ``` -In this case, we stored the result value of the multiplication into a variable called `resulting_value`. +In this case, we stored the resulting value of the multiplication into a variable called `resulting_value`. ## 📝 Instructions: diff --git a/exercises/04-Multiply-Two-Values/app.py b/exercises/04-Multiply-Two-Values/app.py index cfdfa83d..83e80593 100644 --- a/exercises/04-Multiply-Two-Values/app.py +++ b/exercises/04-Multiply-Two-Values/app.py @@ -1 +1 @@ -# your code here +# ✅ ↓ your code here ↓ ✅ diff --git a/exercises/04-Multiply-Two-Values/solution.hide.py b/exercises/04-Multiply-Two-Values/solution.hide.py index ebadd8b3..41c39515 100644 --- a/exercises/04-Multiply-Two-Values/solution.hide.py +++ b/exercises/04-Multiply-Two-Values/solution.hide.py @@ -1,3 +1,4 @@ -# your code here +# ✅ ↓ your code here ↓ ✅ + variables_are_cool = 2345 * 7323 print(variables_are_cool) \ No newline at end of file diff --git a/exercises/04-Multiply-Two-Values/test.py b/exercises/04-Multiply-Two-Values/test.py index ed748d2b..5167a8b0 100644 --- a/exercises/04-Multiply-Two-Values/test.py +++ b/exercises/04-Multiply-Two-Values/test.py @@ -23,7 +23,7 @@ def test_use_variable_name(): @pytest.mark.it('Print on the console the variables_are_cool value ') def test_for_file_output(capsys): captured = buffer.getvalue() - assert captured == '17172435\n' + assert '17172435\n' in captured @pytest.mark.it('Print on the console the variables_are_cool variable') def test_for_print(): diff --git a/exercises/05-User-Inputed-Values/app.py b/exercises/05-User-Inputed-Values/app.py index d9f04a1a..b569ee62 100644 --- a/exercises/05-User-Inputed-Values/app.py +++ b/exercises/05-User-Inputed-Values/app.py @@ -1,4 +1,4 @@ age = int(input('What is your age?\n')) -# CHANGE THE CODE BELOW TO ADD 10 TO AGE +# ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅ print("Your age is: "+str(age)) \ No newline at end of file diff --git a/exercises/05-User-Inputed-Values/solution.hide.py b/exercises/05-User-Inputed-Values/solution.hide.py index f3696298..f9980f94 100644 --- a/exercises/05-User-Inputed-Values/solution.hide.py +++ b/exercises/05-User-Inputed-Values/solution.hide.py @@ -1,4 +1,4 @@ age = int(input('What is your age?\n')) -# CHANGE THE CODE BELOW TO ADD 10 TO AGE +# ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅ age = age + 10 print("Your age is: "+str(age)) diff --git a/exercises/05-User-Inputed-Values/test.py b/exercises/05-User-Inputed-Values/test.py index 75222f2e..2a660472 100644 --- a/exercises/05-User-Inputed-Values/test.py +++ b/exercises/05-User-Inputed-Values/test.py @@ -16,5 +16,5 @@ def test_plus_ten(stdin): sys.stdout = buffer = io.StringIO() import app captured = buffer.getvalue() - assert captured == "Your age is: 60\n" + assert "Your age is: 60\n" in captured diff --git a/exercises/06-String-Concatenation/README.es.md b/exercises/06-String-Concatenation/README.es.md index 7db03f54..382ed1b7 100644 --- a/exercises/06-String-Concatenation/README.es.md +++ b/exercises/06-String-Concatenation/README.es.md @@ -1,17 +1,23 @@ # `06` String Concatenation -Una de las tareas más comunes que tú tendrás que realizar con cualquier lenguaje incluye el unir o combinar strings. +La concatenación de strings es una tarea común en la programación que implica combinar o unir dos o más strings. -A esto le llamamos: **concatenar**. +Puedes pensar en este proceso como conectar dos o más vagones de tren. Si cada string es un vagón, la concatenación es el acoplamiento que los une para formar un tren único. -La mejor forma de explicarlo es cuando tienes dos *strings* separados – almacenados por el intérprete – y tienes que unirlos de forma que sean uno solo. +En Python, puedes concatenar o unir dos o más strings usando el operador `+`. Así es como funciona: ```py + one = 'a' two = 'b' -print(one+two); # esto imprimirá 'ab' en la consola. +print(one + two) # esto imprimirá 'ab' en la consola. ``` -## 📝 Instrucciones: +Aquí, las variables `one` y `two` contienen los strings individuales `'a'` y `'b'`, respectivamente. Cuando usas el operador `+` entre ellos, actúa como un pegamento, uniendo los strings de extremo a extremo. En este caso, une `'a'` y `'b'`, dando como resultado el string concatenado `'ab'`, que se imprime en la consola. + +## 📝 Instrucciones: +1. Establece los valores para `my_var1` y `my_var2` de manera que, al concatenarlos, el código imprima `Hello World` en la consola. + -1. Establece valores para las variables `my_var1` y `my_var2` de forma que el código imprima `Hello World` en la consola. \ No newline at end of file +## 💡 Pista: ++ Si necesitas más explicación sobre como la **concatenación** funciona en Python, puedes ver este clip: https://www.youtube.com/watch?v=T1nyPuAhd1U&ab_channel=ProgramaResuelto (`ctrl + click` en el enlance para abrir el video) diff --git a/exercises/06-String-Concatenation/README.md b/exercises/06-String-Concatenation/README.md index a380a9cc..7bf0f55a 100644 --- a/exercises/06-String-Concatenation/README.md +++ b/exercises/06-String-Concatenation/README.md @@ -4,18 +4,23 @@ tutorial: "https://www.youtube.com/watch?v=kS4qpQmHwCs" # `06` String Concatenation -One common task you’ll need to accomplish with any language involves merging or combining strings. +String concatenation is a common task in programming that involves combining or linking two or more strings together. -This process is referred to as: **concatenation**. +You can think of this process as similar to connecting two or more train cars. If each string is a train car, concatenation is the coupling that joins them to form a single train. -The best way to describe it is when you take two separate strings – stored by the interpreter – and merge them so that they become one. +In Python, you can concatenate, or join together, two or more strings using the `+` operator. This is how it works: ```py + one = 'a' two = 'b' -print(one+two); #this will print 'ab' on the console. +print(one + two) # this will print 'ab' on the console. ``` -## 📝 Instructions: +Here, the variables `one` and `two` hold the individual strings `'a'` and `'b'`. When you use the `+` operator between them, it acts like a glue, sticking the strings together end-to-end. In this case, it joins `'a'` and `'b'`, resulting in the concatenated string `'ab'`, which gets printed to the console. + +## 📝 Instructions: +1. Set the values for `my_var1` and `my_var2` so that when concatenated, the code prints `Hello World` in the console. -1. Set the values for `my_var1` and `my_var2` so the code prints `Hello World` in the console. \ No newline at end of file +## 💡 Hint: ++ If you need further explanation on how string **concatenation** works in python, you can watch this clip: https://www.youtube.com/watch?v=28FUVmWU_fA&ab_channel=PortfolioCourses (`ctrl + click` on the link to open the video) diff --git a/exercises/06-String-Concatenation/app.py b/exercises/06-String-Concatenation/app.py index 49acbc8d..5eefe43b 100644 --- a/exercises/06-String-Concatenation/app.py +++ b/exercises/06-String-Concatenation/app.py @@ -1,4 +1,4 @@ -# Set the values for my_var1 and my_var2 here +# ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅ ## Don't change below this line diff --git a/exercises/06-String-Concatenation/solution.hide.py b/exercises/06-String-Concatenation/solution.hide.py index cc554b3b..45c6ee72 100644 --- a/exercises/06-String-Concatenation/solution.hide.py +++ b/exercises/06-String-Concatenation/solution.hide.py @@ -1,4 +1,5 @@ -# Set the values for my_var1 and my_var2 here +# ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅ + my_var1 = "Hello" my_var2 = "World" diff --git a/exercises/06-String-Concatenation/test.py b/exercises/06-String-Concatenation/test.py index 87d2083a..69fe26a8 100644 --- a/exercises/06-String-Concatenation/test.py +++ b/exercises/06-String-Concatenation/test.py @@ -20,12 +20,12 @@ def test_my_var2_exists(): @pytest.mark.it("Variable my_var1 value should be 'Hello'") def test_my_var1_value(): from app import my_var1 - assert my_var1 == "Hello" + assert my_var1.lower() == "hello" @pytest.mark.it("Variable my_var2 value should be 'World'") def test_my_var2_value(): from app import my_var2 - assert my_var2 == "World" + assert my_var2.lower() == "world" @pytest.mark.it("Variable my_var2 value should be 'World'") def test_the_new_string_exists(): @@ -38,4 +38,4 @@ def test_the_new_string_exists(): @pytest.mark.it('Print "Hello World" on the console') def test_for_file_output(): captured = buffer.getvalue() - assert captured == "Hello World\n" #add \n because the console jumps the line on every print \ No newline at end of file + assert "hello world\n" in captured.lower() #add \n because the console jumps the line on every print \ No newline at end of file diff --git a/exercises/07-Create-a-Basic-HTML/app.py b/exercises/07-Create-a-Basic-HTML/app.py index 6b9a2a3b..ab15ceb0 100644 --- a/exercises/07-Create-a-Basic-HTML/app.py +++ b/exercises/07-Create-a-Basic-HTML/app.py @@ -7,6 +7,7 @@ g = '' h = '<body>' -# ⬆ DON'T CHANGE THE CODE ABOVE ⬆ -# ↓ start coding below here ↓ +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + +# ✅ ↓ start coding below here ↓ ✅ diff --git a/exercises/07-Create-a-Basic-HTML/solution.hide.py b/exercises/07-Create-a-Basic-HTML/solution.hide.py index ca3c2c90..4e180299 100644 --- a/exercises/07-Create-a-Basic-HTML/solution.hide.py +++ b/exercises/07-Create-a-Basic-HTML/solution.hide.py @@ -7,8 +7,9 @@ g = '<title>' h = '<body>' -# ⬆ DON'T CHANGE THE CODE ABOVE ⬆ -# ↓ start coding below here ↓ +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + +# ✅ ↓ start coding below here ↓ ✅ html_document = e+c+g+a+f+h+d+b print(html_document) \ No newline at end of file diff --git a/exercises/07-Create-a-Basic-HTML/test.py b/exercises/07-Create-a-Basic-HTML/test.py index ab3c6ea9..145bbe0a 100644 --- a/exercises/07-Create-a-Basic-HTML/test.py +++ b/exercises/07-Create-a-Basic-HTML/test.py @@ -13,7 +13,7 @@ def test_html_document_exists(): def test_html_document_exists(): try: from app import html_document - assert html_document == '<html><head><title>' + assert html_document == '' except ImportError: raise ImportError("The variable 'html_document' should exist on app.py") @@ -30,4 +30,4 @@ def test_for_concat(): @pytest.mark.it('Print a basic html layout on the console like this: ') def test_for_file_output(): captured = buffer.getvalue() - assert captured == "\n" #add \n because the console jumps the line on every print + assert "\n" in captured #add \n because the console jumps the line on every print diff --git a/exercises/08.1-Your-First-If/README.es.md b/exercises/08.1-Your-First-If/README.es.md index 95857d0b..5fa04204 100644 --- a/exercises/08.1-Your-First-If/README.es.md +++ b/exercises/08.1-Your-First-If/README.es.md @@ -15,3 +15,14 @@ La aplicación actual está preguntando cuánto dinero tiene el usuario. Una vez + Usa un condicional `if/else` para verificar el valor de la variable `total`. + Puedes leer más al respecto [aquí](https://docs.python.org/3/tutorial/controlflow.html#if-statements). + ++ Aquí tienes un recordatorio sobre los operadores relacionales: + + | Operador | Descripción | Sintaxis | + |----------|------------------------------------------------------------------------------|----------| + | > | Mayor que: Verdadero si el operando izquierdo es mayor que el derecho | x > y | + | < | Menor que: Verdadero si el operando izquierdo es menor que el derecho | x < y | + | == | Igual a: Verdadero si ambos operandos son iguales | x == y | + | != | No igual a – Verdadero si los operandos no son iguales | x != y | + | >= | Mayor o igual que: Verdadero si el operando izquierdo es mayor o igual | x >= y | + | <= | Menor o igual que: Verdadero si el operando izquierdo es menor o igual | x <= y | diff --git a/exercises/08.1-Your-First-If/README.md b/exercises/08.1-Your-First-If/README.md index 1b360fc6..e1f1a58e 100644 --- a/exercises/08.1-Your-First-If/README.md +++ b/exercises/08.1-Your-First-If/README.md @@ -4,7 +4,7 @@ tutorial: "https://www.youtube.com/watch?v=x9wqa5WQZiM" # `08.1` Your First if... -The current application is prompting asking how much money the user has. Once the user inputs the amount, we need to **print** one of the following answers: +The current application is asking how much money the user has. Once the user inputs the amount, we need to **print** one of the following answers: ## 📝 Instructions: @@ -19,3 +19,14 @@ The current application is prompting asking how much money the user has. Once th + Use an If/else statement to check the value of the `total` variable. + Further information [here](https://docs.python.org/3/tutorial/controlflow.html#if-statements). + ++ Here's a quick reminder on relational operators: + + | Operator | Description | Syntax | + |----------|--------------------------------------------------------------------|-----------| + | > | Greater than: True if the left operand is greater than the right | x > y | + | < | Less than: True if the left operand is less than the right | x < y | + | == | Equal to: True if both operands are equal | x == y | + | != | Not equal to – True if operands are not equal | x != y | + | >= | Greater than or equal to: True if left operand is greater or equal | x >= y | + | <= | Less than or equal to: True if left operand is less than or equal | x <= y | diff --git a/exercises/08.1-Your-First-If/app.py b/exercises/08.1-Your-First-If/app.py index f455c8c7..6928dd3f 100644 --- a/exercises/08.1-Your-First-If/app.py +++ b/exercises/08.1-Your-First-If/app.py @@ -1,3 +1,3 @@ total = int(input('How much money do you have in your pocket\n')) -# YOUR CODE HERE +# ✅ ↓ YOUR CODE HERE ↓ ✅ diff --git a/exercises/08.1-Your-First-If/solution.hide.py b/exercises/08.1-Your-First-If/solution.hide.py index 9470e5d5..706c21fc 100644 --- a/exercises/08.1-Your-First-If/solution.hide.py +++ b/exercises/08.1-Your-First-If/solution.hide.py @@ -1,6 +1,6 @@ total = int(input('How much money do you have in your pocket\n')) -# YOUR CODE HERE +# ✅ ↓ YOUR CODE HERE ↓ ✅ if total > 100: print("Give me your money!") elif total > 50: diff --git a/exercises/08.1-Your-First-If/test.py b/exercises/08.1-Your-First-If/test.py index a50aeca5..9d479ee5 100644 --- a/exercises/08.1-Your-First-If/test.py +++ b/exercises/08.1-Your-First-If/test.py @@ -29,39 +29,39 @@ def test_for_output_when_101(stdin, capsys, app): with mock.patch('builtins.input', lambda x: 101): app() captured = capsys.readouterr() - assert "Give me your money!\n" == captured.out + assert "Give me your money!\n" in captured.out @pytest.mark.it("When input exactly 100 should print: Buy me some coffee you cheap ") def test_for_output_when_100(capsys, app): with mock.patch('builtins.input', lambda x: 100): app() captured = capsys.readouterr() - assert "Buy me some coffee you cheap!\n" == captured.out + assert "Buy me some coffee you cheap!\n" in captured.out @pytest.mark.it("When input is 99 should print: Buy me some coffee you cheap ") def test_for_output_when_99(capsys, app): with mock.patch('builtins.input', lambda x: 99): app() captured = capsys.readouterr() - assert "Buy me some coffee you cheap!\n" == captured.out + assert "Buy me some coffee you cheap!\n" in captured.out @pytest.mark.it("When input is 51 should print: Buy me some coffee you cheap ") def test_for_output_when_51(capsys, app): with mock.patch('builtins.input', lambda x: 51): app() captured = capsys.readouterr() - assert "Buy me some coffee you cheap!\n" == captured.out + assert "Buy me some coffee you cheap!\n" in captured.out @pytest.mark.it("When input exactly 50 should print: You are a poor guy, go away") def test_for_output_when_50(capsys, app): with mock.patch('builtins.input', lambda x: 50): app() captured = capsys.readouterr() - assert "You are a poor guy, go away!\n" == captured.out + assert "You are a poor guy, go away!\n" in captured.out @pytest.mark.it("When input less than 50 should print: You are a poor guy, go away") def test_for_output_when_49(capsys, app): with mock.patch('builtins.input', lambda x: 49): app() captured = capsys.readouterr() - assert "You are a poor guy, go away!\n" == captured.out \ No newline at end of file + assert "You are a poor guy, go away!\n" in captured.out \ No newline at end of file diff --git a/exercises/08.2-How-Much-The-Wedding-Costs/README.es.md b/exercises/08.2-How-Much-The-Wedding-Costs/README.es.md index 40d1fea7..472fc950 100644 --- a/exercises/08.2-How-Much-The-Wedding-Costs/README.es.md +++ b/exercises/08.2-How-Much-The-Wedding-Costs/README.es.md @@ -9,10 +9,13 @@ Aquí tenemos una tabla de precios de una compañía de catering de bodas: | Hasta 200 personas | $15,000 | | Más de 200 personas | $20,000 | +>Nota: Las cantidades en la tabla incluyen el número especificado. Por ejemplo, "Hasta 50 personas" incluye exactamente 50 personas. ## 📝 Instrucciones: -1. Por favor, escribe un algoritmo que pregunte por el número de invitados a la boda y que imprime el precio correspondiente en la consola. +1. Completa el algoritmo que solicita al usuario el número de personas que asistirán a su boda e imprime el precio correspondiente en la consola. +2. Amplía el código proporcionado a la izquierda para cubrir todos los rangos posibles de invitados. +3. Asegúrate de que tu código calcule e imprima correctamente el precio en la consola según el input del usuario. Por ejemplo, si la persona dice que `20` personas van a la boda, deberìa costar `$4,000` dólares. diff --git a/exercises/08.2-How-Much-The-Wedding-Costs/README.md b/exercises/08.2-How-Much-The-Wedding-Costs/README.md index 37cc9fd2..58ecdd99 100644 --- a/exercises/08.2-How-Much-The-Wedding-Costs/README.md +++ b/exercises/08.2-How-Much-The-Wedding-Costs/README.md @@ -13,10 +13,13 @@ Here is a table of prices for a wedding catering company: | Up to 200 people | $15,000 | | More than 200 people | $20,000 | +> Note: The quantities in the table include the specified number. For example, "Up to 50 people" is inclusive of 50. ## 📝 Instructions: -1. Please write an algorithm that prompts the user for the number of people attending their wedding and prints the corresponding price in the console. +1. Complete the algorithm that prompts the user for the number of people attending their wedding and prints the corresponding price in the console. +2. Extend the given code on the left to cover all possible ranges of guests. +3. Make sure that your code correctly calculates and prints the price in the console based on the user's input. For example, if the user says that `20` people are attending to the wedding, it must cost `$4,000` dollars. diff --git a/exercises/08.2-How-Much-The-Wedding-Costs/app.py b/exercises/08.2-How-Much-The-Wedding-Costs/app.py index a88866b9..2d113a18 100644 --- a/exercises/08.2-How-Much-The-Wedding-Costs/app.py +++ b/exercises/08.2-How-Much-The-Wedding-Costs/app.py @@ -1,6 +1,12 @@ user_input = int(input('How many people are coming to your wedding?\n')) +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + + if user_input <= 50: price = 4000 +# ✅ ↓ Your code here ↓ ✅ + -print('Your wedding will cost '+str(price)+' dollars') \ No newline at end of file +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ +print('Your wedding will cost $'+str(price)+' dollars') \ No newline at end of file diff --git a/exercises/08.2-How-Much-The-Wedding-Costs/solution.hide.py b/exercises/08.2-How-Much-The-Wedding-Costs/solution.hide.py index 1287016d..ac02d9c3 100644 --- a/exercises/08.2-How-Much-The-Wedding-Costs/solution.hide.py +++ b/exercises/08.2-How-Much-The-Wedding-Costs/solution.hide.py @@ -1,7 +1,10 @@ user_input = int(input('How many people are coming to your wedding?\n')) +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + if user_input <= 50: price = 4000 +# ✅ ↓ Your code here ↓ ✅ elif user_input <= 100: price = 10000 elif user_input <= 200: @@ -9,4 +12,5 @@ else: price = 20000 +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ print('Your wedding will cost '+str(price)+' dollars') \ No newline at end of file diff --git a/exercises/08.2-How-Much-The-Wedding-Costs/test.py b/exercises/08.2-How-Much-The-Wedding-Costs/test.py index 6f978279..5a93afaf 100644 --- a/exercises/08.2-How-Much-The-Wedding-Costs/test.py +++ b/exercises/08.2-How-Much-The-Wedding-Costs/test.py @@ -22,7 +22,7 @@ def test__between_100_and_200(capsys, app): app() captured = capsys.readouterr() price = 15000 - assert "Your wedding will cost "+str(price)+" dollars\n" == captured.out + assert "Your wedding will cost "+str(price)+" dollars\n" in captured.out @pytest.mark.it("Between 100 and 51 guests sould be priced 10,000") def test_between_101_and_51(capsys, app): @@ -30,7 +30,7 @@ def test_between_101_and_51(capsys, app): app() captured = capsys.readouterr() price = 10000 - assert "Your wedding will cost "+str(price)+" dollars\n" == captured.out + assert "Your wedding will cost "+str(price)+" dollars\n" in captured.out @pytest.mark.it("Less than 50 guests sould be priced 4,000") @@ -39,7 +39,7 @@ def test_less_than_50(capsys, app): app() captured = capsys.readouterr() price = 4000 - "Your wedding will cost "+str(price)+" dollars\n" == captured.out + "Your wedding will cost "+str(price)+" dollars\n" in captured.out @pytest.mark.it("More than 200 should be priced 20,000") def test_t(capsys, app): @@ -47,4 +47,4 @@ def test_t(capsys, app): app() captured = capsys.readouterr() price = 20000 - "Your wedding will cost "+str(price)+" dollars\n" == captured.out \ No newline at end of file + "Your wedding will cost "+str(price)+" dollars\n" in captured.out \ No newline at end of file diff --git a/exercises/09-Random-Numbers/README.es.md b/exercises/09-Random-Numbers/README.es.md index 55b9bbf9..da28bb47 100644 --- a/exercises/09-Random-Numbers/README.es.md +++ b/exercises/09-Random-Numbers/README.es.md @@ -2,8 +2,12 @@ Puedes usar la función `randint()`para obtener un número entero aleatorio. `randint()` es una funcion interna del módulo **random** en Python 3. -El módulo random da acceso a varias funciones útiles y una de ellas, la función `randint()`, genera números aleatorios entre un rango que le pasemos por parámetro, por ejemplo: `randint(numMinimo, numMaximo)`. +El módulo random da acceso a varias funciones útiles y una de ellas, la función `randint()`, genera números **enteros* aleatorios entre un rango que le pasemos por parámetro, por ejemplo: `randint(numMinimo, numMaximo)`. El numero minimo y el numero maximo en dicho rango son inclusivos. ## 📝 Instrucciones: -1. Actualmente el código está devolviendo números decimales aleatorios, por favor actualiza la función en el código para hacer que devuelva un número entero (no decimal) entre 1 y 10. \ No newline at end of file +1. Actualmente el código está devolviendo números decimales aleatorios, por favor actualiza la función en el código para hacer que devuelva un número entero (no decimal) entre 1 y 10. + +## 💡 Pistas: + ++ Puedes encontrar información addicional sobre el modulo random aquí: https://ellibrodepython.com/numeros-aleatorios-python \ No newline at end of file diff --git a/exercises/09-Random-Numbers/README.md b/exercises/09-Random-Numbers/README.md index d89437f2..021fe0d8 100644 --- a/exercises/09-Random-Numbers/README.md +++ b/exercises/09-Random-Numbers/README.md @@ -6,8 +6,12 @@ tutorial: "https://www.youtube.com/watch?v=uYqMOZ-jFag" You can use the `randint()` function to get a random integer number. `randint()` is an inbuilt function of the **random** module in Python3. -The random module gives access to various useful functions and one of them, **randint()**, being able to generate random numbers within a range that we pass as a parameter, for example: `randint(numMinimum, numMaximum)`. + The random module offers various useful functions, including `randint()`, which generates random **whole** numbers within a given range passed as parameters. You can use it like this: `randint(numMin, numMax)`, where both the minimum and maximum numbers are included in the range. ## 📝 Instructions: -1. The code now is returning random decimal numbers, please update the function code to make it return an integer (no decimal) number between 1 and 10. \ No newline at end of file +1. The code now is returning random decimal numbers, please update the function code to make it return an integer (no decimal) number between 1 and 10. + +## 💡 Hint: + ++ For additional documentation on random module visit: https://www.tutorialsteacher.com/python/random-module \ No newline at end of file diff --git a/exercises/09-Random-Numbers/app.py b/exercises/09-Random-Numbers/app.py index 3c449f3e..9e4d5316 100644 --- a/exercises/09-Random-Numbers/app.py +++ b/exercises/09-Random-Numbers/app.py @@ -1,7 +1,7 @@ import random def get_randomInt(): - # CHANGE ONLY THIS LINE BELOW + # ✅ ↓ CHANGE ONLY THIS ONE LINE BELOW ↓ ✅ random_number = random.random() return random_number diff --git a/exercises/09-Random-Numbers/solution.hide.py b/exercises/09-Random-Numbers/solution.hide.py index 38fabba3..0b5caff3 100644 --- a/exercises/09-Random-Numbers/solution.hide.py +++ b/exercises/09-Random-Numbers/solution.hide.py @@ -1,7 +1,7 @@ import random def get_randomInt(): - # CHANGE ONLY THIS LINE BELOW + # ✅ ↓ CHANGE ONLY THIS ONE LINE BELOW ↓ ✅ random_number = random.randint(1,10) return random_number diff --git a/exercises/10-Calling-Your-First-Function/README.es.md b/exercises/10-Calling-Your-First-Function/README.es.md index 0382e361..70cc213f 100644 --- a/exercises/10-Calling-Your-First-Function/README.es.md +++ b/exercises/10-Calling-Your-First-Function/README.es.md @@ -10,4 +10,9 @@ Las funciones son increíbles por muchas cosas, pero principalmente porque puede ## :mag_right: Importante: - + Hay una serie de ejercicios dedicados a las funciones [aquí](https://github.com/4GeeksAcademy/python-functions-programming-exercises), te recomendamos realizarlos después de hacer **tu primera función** en este ejercicio. (luego..¡Regresa! :smiley:). \ No newline at end of file + + Hay una serie de ejercicios dedicados a las funciones [aquí](https://github.com/4GeeksAcademy/python-functions-programming-exercises), te recomendamos realizarlos después de hacer **tu primera función** en este ejercicio. (luego..¡Regresa! :smiley:). + + + ## 💡Pista: + + + Puedes consultar esta pagina para obtener información adicional sobre funciones y llamadas a funciones: https://www.freecodecamp.org/espanol/news/guia-de-funciones-de-python-con-ejemplos/ \ No newline at end of file diff --git a/exercises/10-Calling-Your-First-Function/README.md b/exercises/10-Calling-Your-First-Function/README.md index 967f4bf8..7a19da1c 100644 --- a/exercises/10-Calling-Your-First-Function/README.md +++ b/exercises/10-Calling-Your-First-Function/README.md @@ -16,3 +16,8 @@ Functions are amazing because of many things, but mainly because you can encapsu ## :mag_right: Important: There's a series of exercises dedicated to Functions [here](https://github.com/4GeeksAcademy/python-functions-programming-exercises), we encourage you to go and finish those after your **first Function exercise** (And then... come back! :smiley). + + +## 💡Hint: + ++ Check this out for additional information on functions and function calls: https://www.w3schools.com/python/python_functions.asp \ No newline at end of file diff --git a/exercises/10-Calling-Your-First-Function/app.py b/exercises/10-Calling-Your-First-Function/app.py index 3855fe88..7e7dd0aa 100644 --- a/exercises/10-Calling-Your-First-Function/app.py +++ b/exercises/10-Calling-Your-First-Function/app.py @@ -3,4 +3,4 @@ def is_odd(my_number): def my_main_code(): - # your code here \ No newline at end of file + # ✅ ↓ Your code here ↓ ✅ \ No newline at end of file diff --git a/exercises/10-Calling-Your-First-Function/solution.hide.py b/exercises/10-Calling-Your-First-Function/solution.hide.py new file mode 100644 index 00000000..e51d6d94 --- /dev/null +++ b/exercises/10-Calling-Your-First-Function/solution.hide.py @@ -0,0 +1,7 @@ +def is_odd(my_number): + return (my_number % 2 != 0) + + +def my_main_code(): + # ✅ ↓ Your code here ↓ ✅ + print(is_odd(45345)) \ No newline at end of file diff --git a/exercises/10-Calling-Your-First-Function/test.py b/exercises/10-Calling-Your-First-Function/test.py index 522837e1..9deb6879 100644 --- a/exercises/10-Calling-Your-First-Function/test.py +++ b/exercises/10-Calling-Your-First-Function/test.py @@ -8,7 +8,7 @@ def test_functions_existence(app): raise AttributeError("The function is_odd should exist") @pytest.mark.it('The function my_main_code should exist') -def test_functions_existence(app): +def test_functions_existence_main(app): try: app.my_main_code except AttributeError: @@ -34,5 +34,5 @@ def test_for_file_output(capsys): from app import my_main_code my_main_code() captured = capsys.readouterr() - assert captured.out == "True\n" + assert "True\n" in captured.out diff --git a/exercises/10.1-Creating-Your-First-Function/app.py b/exercises/10.1-Creating-Your-First-Function/app.py index a99c68a9..bea9825c 100644 --- a/exercises/10.1-Creating-Your-First-Function/app.py +++ b/exercises/10.1-Creating-Your-First-Function/app.py @@ -1,6 +1,6 @@ def addNumbers(a,b): - # This is the function body. Write your code here. - + # This is the function body. ✅↓ Write your code here. ↓✅ + -# Do not change the code below +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ print(addNumbers(3,4)) diff --git a/exercises/10.1-Creating-Your-First-Function/solution.hide.py b/exercises/10.1-Creating-Your-First-Function/solution.hide.py new file mode 100644 index 00000000..619f2145 --- /dev/null +++ b/exercises/10.1-Creating-Your-First-Function/solution.hide.py @@ -0,0 +1,6 @@ +def addNumbers(a,b): + # This is the function body. ✅↓ Write your code here. ↓✅ + return b + a + +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ +print(addNumbers(3,4)) diff --git a/exercises/10.1-Creating-Your-First-Function/test.py b/exercises/10.1-Creating-Your-First-Function/test.py index fcceb43e..ae4b341d 100644 --- a/exercises/10.1-Creating-Your-First-Function/test.py +++ b/exercises/10.1-Creating-Your-First-Function/test.py @@ -37,7 +37,7 @@ def test_for_return(): assert result == 7 @pytest.mark.it('Function should sum the two given numbers. Testing with different numbers') -def test_for_return(): +def test_for_return_2(): from app import addNumbers result = addNumbers(10,5) assert result == 15 \ No newline at end of file diff --git a/exercises/11-Create-A-New-Function/README.es.md b/exercises/11-Create-A-New-Function/README.es.md index a46c710e..c1ae2f22 100644 --- a/exercises/11-Create-A-New-Function/README.es.md +++ b/exercises/11-Create-A-New-Function/README.es.md @@ -20,13 +20,15 @@ r1 = random.randint(0, 10) print("Random number between 0 and 10 is % s" % (r1)) ``` -Puedes usar la función `randint()` para obtener un número decimal aleatorio. Esta es una función incorporada del **módulo random** en Python3. +Puedes usar la función `randint()` para obtener un número entero aleatorio. Esta es una función incorporada del **módulo random** en Python3. El **módulo random** te da acceso a varias funciones útiles y una de ellas es, `randint()`, capaz de generar números aleatorios. ## 📝 Instrucciones: -1. Por favor, ahora crea una función llamada `generate_random` que imprima y devuelva un número aleatorio entre 0 y 9 cada vez que le llame. +1. Por favor, ahora crea una función llamada `generate_random` que devuelva un número aleatorio entre 0 y 9 cada vez que le llame. + +2. Imprime el resultado que la función retorna al ser llamada. ## 💡 Pistas: diff --git a/exercises/11-Create-A-New-Function/README.md b/exercises/11-Create-A-New-Function/README.md index d321ae06..e79fc1e0 100644 --- a/exercises/11-Create-A-New-Function/README.md +++ b/exercises/11-Create-A-New-Function/README.md @@ -21,13 +21,15 @@ r1 = random.randint(0, 10) print("Random number between 0 and 10 is % s" % (r1)) ``` -You can use the `randint()` function to get a random decimal number. `Randint()` is an inbuilt function of the **random module** in Python3. +You can use the `randint()` function to get a random whole number. `randint()` is an inbuilt function of the **random module** in Python3. The **random module** gives access to various useful functions and one of them being able to generate random numbers, which is `randint()`. ## 📝 Instructions: -1. Please now create a function called `generate_random` that prints and returns a random number between 0 and 9 every time it is called. +1. Please now create a function called `generate_random` that returns a random number between 0 and 9 every time it is called. + +2. Print the result that the function call returns. ## 💡 Hints: diff --git a/exercises/11-Create-A-New-Function/app.py b/exercises/11-Create-A-New-Function/app.py index f647a114..ed1c5597 100644 --- a/exercises/11-Create-A-New-Function/app.py +++ b/exercises/11-Create-A-New-Function/app.py @@ -1,3 +1,3 @@ import random -# your code here \ No newline at end of file +# ✅↓ Write your code here. ↓✅ diff --git a/exercises/11-Create-A-New-Function/solution.hide.py b/exercises/11-Create-A-New-Function/solution.hide.py index 9c27fec9..943706e3 100644 --- a/exercises/11-Create-A-New-Function/solution.hide.py +++ b/exercises/11-Create-A-New-Function/solution.hide.py @@ -1,6 +1,6 @@ import random -# your code here +# ✅↓ Write your code here. ↓✅ def generate_random(): result = random.randint(0,9) return result \ No newline at end of file diff --git a/exercises/11-Create-A-New-Function/test.py b/exercises/11-Create-A-New-Function/test.py index 236b34f0..cb308b05 100644 --- a/exercises/11-Create-A-New-Function/test.py +++ b/exercises/11-Create-A-New-Function/test.py @@ -30,3 +30,10 @@ def test_for_type_random(): regex = re.compile(r"random.randint\s*\(") regex2 = re.compile(r"random.randrange\s*\(") assert bool(regex.search(content)) == True or bool(regex2.search(content)) == True + +@pytest.mark.it('You should be using print()') +def test_for_type_random(): + with open(path, 'r') as content_file: + content = content_file.read() + + assert "print" in content diff --git a/exercises/12-Rand-From-One-to-Twelve/app.py b/exercises/12-Rand-From-One-to-Twelve/app.py index 234be83c..7b5483ce 100644 --- a/exercises/12-Rand-From-One-to-Twelve/app.py +++ b/exercises/12-Rand-From-One-to-Twelve/app.py @@ -1,7 +1,8 @@ import random def get_randomInt(): - # Your code here + # ✅↓ Write your code here. ↓✅ return None +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ print(get_randomInt()) \ No newline at end of file diff --git a/exercises/12-Rand-From-One-to-Twelve/solution.hide.py b/exercises/12-Rand-From-One-to-Twelve/solution.hide.py index e8f45913..00d751b7 100644 --- a/exercises/12-Rand-From-One-to-Twelve/solution.hide.py +++ b/exercises/12-Rand-From-One-to-Twelve/solution.hide.py @@ -1,7 +1,9 @@ import random def get_randomInt(): + # ✅↓ Write your code here. ↓✅ random_number = random.randrange(1,13) return random_number +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ print(get_randomInt()) \ No newline at end of file diff --git a/exercises/12-Rand-From-One-to-Twelve/test.py b/exercises/12-Rand-From-One-to-Twelve/test.py index 42c6e1da..fe26718e 100644 --- a/exercises/12-Rand-From-One-to-Twelve/test.py +++ b/exercises/12-Rand-From-One-to-Twelve/test.py @@ -20,7 +20,7 @@ def test_function_existence(app): def test_conditional(): with open(path, 'r') as content_file: content = content_file.read() - pattern = r"random\.randrange\s*\(\s*1\s*,\s*13\s*\)" + pattern = r"random\s*\.\s*randrange\s*\(\s*1\s*,\s*13\s*\)" regex = re.compile(pattern) assert bool(regex.search(content)) == True diff --git a/exercises/13-Create-A-For-Loop/README.es.md b/exercises/13-Create-A-For-Loop/README.es.md index bf7189c1..791965dc 100644 --- a/exercises/13-Create-A-For-Loop/README.es.md +++ b/exercises/13-Create-A-For-Loop/README.es.md @@ -6,7 +6,7 @@ El bucle o loop `for` te permite ejecutar el mismo código varias veces para dif ## 📝 Instrucciones: -1. Crea una función llamada `standards_maker()`. +1. Completa la función llamada `standards_maker()`. 2. La función tiene que imprimir 300 veces la frase "Escribiré preguntas si estoy atascado". diff --git a/exercises/13-Create-A-For-Loop/README.md b/exercises/13-Create-A-For-Loop/README.md index 5487fd09..22af4705 100644 --- a/exercises/13-Create-A-For-Loop/README.md +++ b/exercises/13-Create-A-For-Loop/README.md @@ -10,7 +10,7 @@ The `for` loop lets you run the same code for different values. ## 📝 Instructions: -1. Create a function called `standards_maker`. +1. Complete the function called `standards_maker`. 2. The function has to print 300 times the phrase "I will write questions if I am stuck". diff --git a/exercises/13-Create-A-For-Loop/app.py b/exercises/13-Create-A-For-Loop/app.py index 23a78ce0..cc52a510 100644 --- a/exercises/13-Create-A-For-Loop/app.py +++ b/exercises/13-Create-A-For-Loop/app.py @@ -1,4 +1,5 @@ def standards_maker(): - #your code here + # ✅↓ Write your code here. ↓✅ -#remember to call the function outside (here) \ No newline at end of file + +# ✅↓ remember to call the function outside (here) ↓✅ \ No newline at end of file diff --git a/exercises/13-Create-A-For-Loop/solution.hide.py b/exercises/13-Create-A-For-Loop/solution.hide.py index 9c472f02..a616c235 100644 --- a/exercises/13-Create-A-For-Loop/solution.hide.py +++ b/exercises/13-Create-A-For-Loop/solution.hide.py @@ -1,7 +1,7 @@ def standards_maker(): - #your code here + # ✅↓ Write your code here. ↓✅ for i in range(0, 300): print("I will write questions if I am stuck") -#remember to call the function outside (here) +# ✅↓ remember to call the function outside (here) ↓✅ standards_maker() \ No newline at end of file diff --git a/exercises/14-Your-First-Loop/README.es.md b/exercises/14-Your-First-Loop/README.es.md index 2d18722f..cfd69ae6 100644 --- a/exercises/14-Your-First-Loop/README.es.md +++ b/exercises/14-Your-First-Loop/README.es.md @@ -10,4 +10,7 @@ + Hay una serie de ejercicios dedicados a listas y bucles o loops, te invitamos a realizarlos antes de continuar: [https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises](https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises). -!Luego, regresa!😊 \ No newline at end of file +!Luego, regresa!😊 + +## 💡 Pista: ++ Puedes encontrar información adicional aquí: https://tutorial.recursospython.com/bucles/ \ No newline at end of file diff --git a/exercises/14-Your-First-Loop/README.md b/exercises/14-Your-First-Loop/README.md index 6dc29800..990b2bd4 100644 --- a/exercises/14-Your-First-Loop/README.md +++ b/exercises/14-Your-First-Loop/README.md @@ -14,4 +14,7 @@ tutorial: "https://www.youtube.com/watch?v=30sizcnVdGg" + There's a series of exercises dedicated to Lists and Loops, we encourage you to go and finish those before continuing: [https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises](https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises). -Then, come back!😊 \ No newline at end of file +Then, come back!😊 + +## 💡Hint: ++ You can find additional information on loops here: https://www.w3schools.com/python/python_for_loops.asp \ No newline at end of file diff --git a/exercises/14-Your-First-Loop/test.py b/exercises/14-Your-First-Loop/test.py index 4137a9ad..51b6b831 100644 --- a/exercises/14-Your-First-Loop/test.py +++ b/exercises/14-Your-First-Loop/test.py @@ -20,7 +20,7 @@ def test_for_function_existence(): def test_for_function_output(capsys): app.start_counting() captured = capsys.readouterr() - assert "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n" == captured.out + assert "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n" in captured.out @pytest.mark.it('Use for loop') def test_for_loop(): diff --git a/exercises/15-Looping-With-FizzBuzz/README.es.md b/exercises/15-Looping-With-FizzBuzz/README.es.md index cd304d2b..5e0706c6 100644 --- a/exercises/15-Looping-With-FizzBuzz/README.es.md +++ b/exercises/15-Looping-With-FizzBuzz/README.es.md @@ -32,6 +32,13 @@ Fizz Buzz ``` +## 🔎 Importante: + ++ Hay una serie de ejercicios dedicados a listas y ciclos, te invitamos a realizarlos antes de continuar: [https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises](https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises). + +¡Luego, regresa!😊 + + ## 💡 Pistas: + Para múltiplos de 3, en lugar de imprimir el número, imprime "Fizz". @@ -40,8 +47,3 @@ Buzz + Para números que son múltiplos de 3 y de 5, imprime "FizzBuzz". -## 🔎 Importante: - -+ Hay una serie de ejercicios dedicados a listas y ciclos, te invitamos a realizarlos antes de continuar: [https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises](https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises). - -¡Luego, regresa!😊 diff --git a/exercises/15-Looping-With-FizzBuzz/README.md b/exercises/15-Looping-With-FizzBuzz/README.md index 28170eea..97b52c0f 100644 --- a/exercises/15-Looping-With-FizzBuzz/README.md +++ b/exercises/15-Looping-With-FizzBuzz/README.md @@ -36,16 +36,17 @@ Fizz Buzz ``` + +## 🔎 Important: + +There's a series of exercises dedicated to Lists and Loops, we encourage you to go and finish them before continuing: [https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises](https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises) + +Then, come back!😊 + ## 💡 Hints: + For multiples of 3, instead of the number, print "Fizz". + For multiples of 5, print "Buzz". -+ For numbers which are multiples of both 3 and 5, print "FizzBuzz". - -## 🔎 Important: - -There's a series of exercises dedicated to Lists and Loops, we encourage you to go and finish them before continuing: [https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises](https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises) - -Then, come back!😊 \ No newline at end of file ++ For numbers which are multiples of both 3 and 5, print "FizzBuzz". \ No newline at end of file diff --git a/exercises/15-Looping-With-FizzBuzz/app.py b/exercises/15-Looping-With-FizzBuzz/app.py index daab9805..31d72741 100644 --- a/exercises/15-Looping-With-FizzBuzz/app.py +++ b/exercises/15-Looping-With-FizzBuzz/app.py @@ -1,5 +1,5 @@ def fizz_buzz(): - # your code here - + # ✅↓ Write your code here. ↓✅ +# ❌↓ DON'T CHANGE THE CODE BELOW ↓❌ fizz_buzz() \ No newline at end of file diff --git a/exercises/15-Looping-With-FizzBuzz/solution.hide.py b/exercises/15-Looping-With-FizzBuzz/solution.hide.py index 3bd4c511..2ae1311c 100644 --- a/exercises/15-Looping-With-FizzBuzz/solution.hide.py +++ b/exercises/15-Looping-With-FizzBuzz/solution.hide.py @@ -1,5 +1,5 @@ def fizz_buzz(): - # your code here + # ✅↓ Write your code here. ↓✅ for i in range(1, 101): if i % 3 == 0 and i % 5 == 0: print("FizzBuzz") @@ -10,4 +10,5 @@ def fizz_buzz(): else: print(i) +# ❌↓ DON'T CHANGE THE CODE BELOW ↓❌ fizz_buzz() \ No newline at end of file diff --git a/exercises/15-Looping-With-FizzBuzz/test.py b/exercises/15-Looping-With-FizzBuzz/test.py index 159efd1f..5d8187c2 100644 --- a/exercises/15-Looping-With-FizzBuzz/test.py +++ b/exercises/15-Looping-With-FizzBuzz/test.py @@ -27,4 +27,4 @@ def test_for_loop(): def test_for_function_output(capsys): fizz_buzz() captured = capsys.readouterr() - assert captured.out == "1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz\n" + assert "1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz\n" in captured.out diff --git a/exercises/16-Random-Colors-Loop/README.es.md b/exercises/16-Random-Colors-Loop/README.es.md index 74a09263..bbb78609 100644 --- a/exercises/16-Random-Colors-Loop/README.es.md +++ b/exercises/16-Random-Colors-Loop/README.es.md @@ -1,6 +1,6 @@ # `16` Random Colors (Loop) -Hemos creado una función que devuelve un color basado en un número entre 0 y 3 (cualquier número diferente, debe retornar el color `black`). +Hemos creado una función que devuelve un color basado en un número entre 0 y 3 (cualquier número diferente, debe retornar el color `black` (negro)). Digamos que somos profesores en un aula con 10 estudiantes y queremos asignar a **cada estudiante** un color aleatorio entre `red` (rojo), `yellow` (amarillo), `blue` (azul) y `green` (verde). diff --git a/exercises/16-Random-Colors-Loop/app.py b/exercises/16-Random-Colors-Loop/app.py index 11a4eb92..5753c14a 100644 --- a/exercises/16-Random-Colors-Loop/app.py +++ b/exercises/16-Random-Colors-Loop/app.py @@ -13,11 +13,12 @@ def get_color(color_number=4): } return switcher.get(color_number,"Invalid Color Number") +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ def get_allStudentColors(): example_color = get_color(1) students_array = [] - #your loop here + # ✅ ↓ your loop here ↓ ✅ print(get_allStudentColors()) \ No newline at end of file diff --git a/exercises/16-Random-Colors-Loop/solution.hide.py b/exercises/16-Random-Colors-Loop/solution.hide.py new file mode 100644 index 00000000..17b87502 --- /dev/null +++ b/exercises/16-Random-Colors-Loop/solution.hide.py @@ -0,0 +1,28 @@ +import random + +def get_color(color_number=4): + # making sure is a number and not a string + color_number = int(color_number) + + switcher={ + 0:'red', + 1:'yellow', + 2:'blue', + 3:'green', + 4:'black' + } + return switcher.get(color_number,"Invalid Color Number") + +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + +def get_allStudentColors(): + example_color = get_color(1) + students_array = [] + # ✅ ↓ your loop here ↓ ✅ + for i in range(10): + students_array.append(get_color(random.randint(0,3))) + + return students_array + + +print(get_allStudentColors()) \ No newline at end of file diff --git a/exercises/17-Russian-Roulette/README.es.md b/exercises/17-Russian-Roulette/README.es.md index 76c1545c..f6b4e500 100644 --- a/exercises/17-Russian-Roulette/README.es.md +++ b/exercises/17-Russian-Roulette/README.es.md @@ -7,12 +7,13 @@ gira la cámara del revolver para hacer aleatorio el juego. Nadie sabrá dónde ¡¡¡FUEGO!!!....... ¿has muerto? -## 📝 Instrucciones: +## 📝 Instrucciones: +1. El juego casi funciona, por favor completa la función `fire_gun` para que el juego funcione. -1. El juego casi funciona, por favor completa la función `fire_gun` para hacer que el juego funcione. +2. Compara la posición de la bala con la posición de la recámara. -2. Compara la posición de la bala contra la posición de la cámara. +3. Si la posición de la bala es igual a la posición de la recámara, entonces la función debe retornar `You are dead!`, de lo contrario, debe retornar `Keep playing!` -## 💡 Pista: - -+ La función necesita devolver `You are dead!` (Estás muerto) o `Keep playing!` (Sigue jugando) dependiendo del resultado. Si la bala está en la misma recámara que la del revolver, entonces fue disparada (You are dead!). \ No newline at end of file +## 💡 Pista: +- Puedes obtener la posición de la recámara llamando a la función `spin_chamber`. +- Si la bala está en el mismo compartimento que la recámara del revólver, entonces será disparada (`You are dead!`). \ No newline at end of file diff --git a/exercises/17-Russian-Roulette/README.md b/exercises/17-Russian-Roulette/README.md index e7f1d4a5..43228267 100644 --- a/exercises/17-Russian-Roulette/README.md +++ b/exercises/17-Russian-Roulette/README.md @@ -1,6 +1,6 @@ # `17` Russian Roulette -Have you ever played Russian Roulette? It's super fun! If you make it (wuuuajajajaja). +Have you ever played Russian Roulette? It's super fun! If you make it (muahahahaha). The revolver gun has only 6 slots for bullets... insert one bullet in one of the slots, spin the revolver chamber to make the game random, nobody knows the bullet position. @@ -13,8 +13,10 @@ FIRE!!!....... are you dead? 2. Compare the bullet position against the chamber position. +3. If the bullet position is equal to the chamber position then the function should return `You are dead!`, else it should return `Keep playing!` + ## 💡 Hint: -+ The function needs to return `You are dead!` or `Keep playing!` depending on the result. ++ You can get the chamber position by calling the `spin_chamber` function + If the bullet is at the same slot as the revolver chamber, then it will be fired (`You are dead!`). \ No newline at end of file diff --git a/exercises/17-Russian-Roulette/app.py b/exercises/17-Russian-Roulette/app.py index 30748c0f..d0503ccc 100644 --- a/exercises/17-Russian-Roulette/app.py +++ b/exercises/17-Russian-Roulette/app.py @@ -6,12 +6,10 @@ def spin_chamber(): chamber_position = random.randint(1,6) return chamber_position -# DON'T CHANGE THE CODE ABOVE +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ def fire_gun(): - # YOUR CODE HERE + # ✅ ↓ your loop here ↓ ✅ return None - - print(fire_gun()) \ No newline at end of file diff --git a/exercises/17-Russian-Roulette/solution.hide.py b/exercises/17-Russian-Roulette/solution.hide.py index 824f957e..afdfddeb 100644 --- a/exercises/17-Russian-Roulette/solution.hide.py +++ b/exercises/17-Russian-Roulette/solution.hide.py @@ -6,9 +6,9 @@ def spin_chamber(): chamber_position = random.randint(1,6) return chamber_position -# DON'T CHANGE THE CODE ABOVE +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ def fire_gun(): - # YOUR CODE HERE + # ✅ ↓ your loop here ↓ ✅ if spin_chamber() == bullet_position: return "You're dead!" else: diff --git a/exercises/18-The-Beatles/README.es.md b/exercises/18-The-Beatles/README.es.md index 1f9a455f..b58308bf 100644 --- a/exercises/18-The-Beatles/README.es.md +++ b/exercises/18-The-Beatles/README.es.md @@ -21,3 +21,5 @@ Este es el coro de una de las canciones más famosas de la banda: ## 💡 Pista: + La frase "let it be" se repite todo el tiempo. Probablemente deberías usar un bucle o loop para eso 😊 + ++ Si necesitas un repaso sobre los loops y/o condicionales, échale un vistazo a esto: https://docs.python.org/es/3/tutorial/controlflow.html diff --git a/exercises/18-The-Beatles/README.md b/exercises/18-The-Beatles/README.md index 17c88585..af3a8a78 100644 --- a/exercises/18-The-Beatles/README.md +++ b/exercises/18-The-Beatles/README.md @@ -24,4 +24,6 @@ This is the chorus of one of the most famous Beatle songs: ## 💡 Hint: -+ The words "let it be" repeat all the time, you should probably create a loop for that. \ No newline at end of file ++ The words "let it be" repeat all the time, you should probably create a loop for that. + ++ If you need a refresher on loops and conditionals, check out this awesome resource: https://docs.python.org/3/tutorial/controlflow.html \ No newline at end of file diff --git a/exercises/18-The-Beatles/app.py b/exercises/18-The-Beatles/app.py index a5c3e59c..fd8b3103 100644 --- a/exercises/18-The-Beatles/app.py +++ b/exercises/18-The-Beatles/app.py @@ -1 +1,2 @@ -# Your code here!! +# ✅↓ Write your code here. ↓✅ + diff --git a/exercises/18-The-Beatles/solution.hide.py b/exercises/18-The-Beatles/solution.hide.py index e61550ca..1088905d 100644 --- a/exercises/18-The-Beatles/solution.hide.py +++ b/exercises/18-The-Beatles/solution.hide.py @@ -1,4 +1,4 @@ -# Your code here!! +# ✅↓ Write your code here. ↓✅ def sing(): song = "" for i in range(11): diff --git a/exercises/19-Bottles-Of-Milk/README.md b/exercises/19-Bottles-Of-Milk/README.md index 7b9451c7..ef5f2704 100644 --- a/exercises/19-Bottles-Of-Milk/README.md +++ b/exercises/19-Bottles-Of-Milk/README.md @@ -38,6 +38,6 @@ Go to the store and buy some more, 99 bottles of milk on the wall. ## 💡Hints: -+ At the end of the song, the lyrics change because is only one bottle (singular instead of plural). ++ At the end of the song, the lyrics change because it is only **one** bottle (singular instead of plural). + Read the last lyrics and you will see how the last line changes to `"go to the store and buy some more"`. \ No newline at end of file diff --git a/exercises/19-Bottles-Of-Milk/app.py b/exercises/19-Bottles-Of-Milk/app.py index 463eb34c..9ff11964 100644 --- a/exercises/19-Bottles-Of-Milk/app.py +++ b/exercises/19-Bottles-Of-Milk/app.py @@ -1 +1 @@ -# Your code here! +# ✅↓ Write your code here. ↓✅ diff --git a/exercises/19-Bottles-Of-Milk/solution.hide.py b/exercises/19-Bottles-Of-Milk/solution.hide.py index 81f2ad98..52000ba9 100644 --- a/exercises/19-Bottles-Of-Milk/solution.hide.py +++ b/exercises/19-Bottles-Of-Milk/solution.hide.py @@ -1,3 +1,4 @@ +# ✅↓ Write your code here. ↓✅ def number_of_bottles(): for x in range(99,2,-1): print(str(x) + " bottles of milk on the wall, " + str(x) + " bottles of milk. Take one down and pass it around, " + str(x-1)+ " bottles of milk on the wall.")