Skip to content

Commit 31fe53c

Browse files
authored
Merge pull request #86 from UmiKami/exercise-enhancement-Q3-2023
Exercise enhancement q3 2023 - first 10
2 parents 132dd9e + 1e62d64 commit 31fe53c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+301
-132
lines changed

exercises/01-Console/README.es.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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".
44

5-
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).
5+
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).
66

77
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.
88

@@ -14,4 +14,12 @@ print("Un texto en la consola")
1414

1515
## 📝 Instrucciones:
1616

17-
1. usa **print** para escribir `Hello World!` en la consola. Siéntete libre de intentar otras cosas también.
17+
1. usa **print** para escribir `Hello World!` en la consola.
18+
19+
## 💡 Pistas:
20+
21+
+ 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:
22+
23+
https://i.imgur.com/w6u4aDd.png
24+
25+
+ Siéntete libre de intentar otras cosas también.

exercises/01-Console/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tutorial: "https://www.youtube.com/watch?v=2sV-2frucUs"
66

77
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".
88

9-
Every language has a console, as it was the only way to interact with the users at the beginning (before Windows or MacOS arrived).
9+
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).
1010

1111
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.
1212

@@ -18,4 +18,13 @@ print("How are you?")
1818

1919
## 📝 Instructions:
2020

21-
1. Use **print** to print `Hello World!` on the console. Feel free to try other things as well.
21+
1. Use **print** to print `Hello World!` on the console.
22+
23+
24+
## 💡 Hints:
25+
26+
+ Remember, to run the code and see the output on the console, click on the box icon in the top left of the screen:
27+
28+
https://i.imgur.com/w6u4aDd.png
29+
30+
+ Feel free to try other things as well.

exercises/01-Console/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ def test_for_file_output(capsys):
1919
@pytest.mark.it('Print Hello World! on the console')
2020
def test_for_console_log(capsys):
2121
captured = buffer.getvalue()
22-
assert captured == "Hello World!\n" #add \n because the console jumps the line on every print
22+
assert "Hello World!\n" in captured #add \n because the console jumps the line on every print
2323

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# `02` Declare Variables
22

3-
Las variables actúan como una caja (contenedor) que te permite almacenar distintos tipos de datos. Así es como se define una variable:
3+
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:
44

55
```py
66
name = "Daniel"
77
```
88

9+
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.
10+
911
## 📝 Instrucciones:
1012

11-
1. Declara una variable con el valor "Yellow" y luego imprímelo en la consola.
13+
1. Declara una variable con el valor `"Yellow"` y luego imprímelo en la consola.
1214

1315
2. Luego, imprime su valor en la consola usando `print(name)`.
1416

1517
## 💡 Pista:
1618

1719
+ Puedes darle el nombre que quieras a la variable, pero su valor tiene que ser el texto "Yellow".
20+
21+
+ 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)

exercises/02-Declare-Variables/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ tutorial: "https://www.youtube.com/watch?v=dWWvZkaPwDw"
44

55
# `02` Declare Variables
66

7-
Variables act as a box (container) that lets you store different types of data. This is how we set a variable:
7+
In programming, we use variables like boxes (or containers) to store different kinds of information. Here's how to create a variable:
88

99
```py
1010
name = "Daniel"
1111
```
1212

13+
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.
14+
1315
## 📝 Instructions:
1416

15-
1. Declare a new variable with the string value "Yellow" and print the value to the console.
17+
1. Declare a new variable with the string value `"Yellow"` and print the value to the console.
1618

1719
2. Then, print its value on the console using `print(name)`.
1820

1921
## 💡 Hint:
2022

2123
+ The name of the variable can be whatever you want, but the value inside has to be the string "Yellow".
24+
+ 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)

exercises/02-Declare-Variables/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# your code here
1+
# ✅ ↓ your code here ↓ ✅
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# your code here
1+
# ✅ ↓ your code here ↓ ✅
22

33
color = "Yellow"
44
print(color)

exercises/02-Declare-Variables/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def test_for_variable():
2727
@pytest.mark.it('Print the variable on the console')
2828
def test_for_file_output(capsys):
2929
captured = buffer.getvalue()
30-
assert captured == "Yellow\n" #add \n because the console jumps the line on every print
30+
assert "Yellow\n" in captured #add \n because the console jumps the line on every print
3131

3232

exercises/03-Print-Variables-In-The-Console/README.es.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ print(my_super_variable)
99

1010
## 📝 Instrucciones:
1111

12-
1. Declara una nueva variable llamada `color` y asígnale el valor `red`.
12+
1. Declara una nueva variable llamada `color` y asígnale el valor `"red"`.
1313

1414
2. Luego, imprime su valor en la consola (puede que tengas que desplazarte en la consola para poder verlo).

exercises/03-Print-Variables-In-The-Console/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ print(my_super_variable)
1313

1414
## 📝 Instructions:
1515

16-
1. Declare a new variable called `color` and assign the value `red` to it.
16+
1. Declare a new variable called `color` and assign the value `"red"` to it.
1717

1818
2. Then, print its value on the console (you may have to scroll up in the terminal to see it!).
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#your code here
1+
# ✅ ↓ your code here ↓ ✅
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#your code here
1+
# ✅ ↓ your code here ↓ ✅
22

33
color = "red"
44
print(color)

exercises/03-Print-Variables-In-The-Console/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@pytest.mark.it("Create a variable named 'color' with the string value red")
1212
def test_declare_variable():
1313
result = app.color
14-
assert result == "red"
14+
assert result == "red"
1515

1616
@pytest.mark.it('Print on the console the value of the variable ')
1717
def test_for_printing_variable():
@@ -24,4 +24,4 @@ def test_for_printing_variable():
2424
@pytest.mark.it('The printed value on the console should be "red"')
2525
def test_for_file_output(capsys):
2626
captured = buffer.getvalue()
27-
assert captured == "red\n"
27+
assert "red\n" in captured

exercises/04-Multiply-Two-Values/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To multiply 2 values in python, you have to use the asterisk operator like this:
1212
resulting_value = 2 * 3
1313
```
1414

15-
In this case, we stored the result value of the multiplication into a variable called `resulting_value`.
15+
In this case, we stored the resulting value of the multiplication into a variable called `resulting_value`.
1616

1717
## 📝 Instructions:
1818

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# your code here
1+
# ✅ ↓ your code here ↓ ✅
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
# your code here
1+
# ✅ ↓ your code here ↓ ✅
2+
23
variables_are_cool = 2345 * 7323
34
print(variables_are_cool)

exercises/04-Multiply-Two-Values/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_use_variable_name():
2323
@pytest.mark.it('Print on the console the variables_are_cool value ')
2424
def test_for_file_output(capsys):
2525
captured = buffer.getvalue()
26-
assert captured == '17172435\n'
26+
assert '17172435\n' in captured
2727

2828
@pytest.mark.it('Print on the console the variables_are_cool variable')
2929
def test_for_print():
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
age = int(input('What is your age?\n'))
2-
# CHANGE THE CODE BELOW TO ADD 10 TO AGE
2+
# ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅
33

44
print("Your age is: "+str(age))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
age = int(input('What is your age?\n'))
2-
# CHANGE THE CODE BELOW TO ADD 10 TO AGE
2+
# ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅
33
age = age + 10
44
print("Your age is: "+str(age))

exercises/05-User-Inputed-Values/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ def test_plus_ten(stdin):
1616
sys.stdout = buffer = io.StringIO()
1717
import app
1818
captured = buffer.getvalue()
19-
assert captured == "Your age is: 60\n"
19+
assert "Your age is: 60\n" in captured
2020

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
# `06` String Concatenation
22

3-
Una de las tareas más comunes que tú tendrás que realizar con cualquier lenguaje incluye el unir o combinar strings.
3+
La concatenación de strings es una tarea común en la programación que implica combinar o unir dos o más strings.
44

5-
A esto le llamamos: **concatenar**.
5+
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.
66

7-
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.
7+
En Python, puedes concatenar o unir dos o más strings usando el operador `+`. Así es como funciona:
88

99
```py
10+
1011
one = 'a'
1112
two = 'b'
12-
print(one+two); # esto imprimirá 'ab' en la consola.
13+
print(one + two) # esto imprimirá 'ab' en la consola.
1314
```
1415

15-
## 📝 Instrucciones:
16+
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.
17+
18+
## 📝 Instrucciones:
19+
1. Establece los valores para `my_var1` y `my_var2` de manera que, al concatenarlos, el código imprima `Hello World` en la consola.
20+
1621

17-
1. Establece valores para las variables `my_var1` y `my_var2` de forma que el código imprima `Hello World` en la consola.
22+
## 💡 Pista:
23+
+ 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)

exercises/06-String-Concatenation/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ tutorial: "https://www.youtube.com/watch?v=kS4qpQmHwCs"
44

55
# `06` String Concatenation
66

7-
One common task you’ll need to accomplish with any language involves merging or combining strings.
7+
String concatenation is a common task in programming that involves combining or linking two or more strings together.
88

9-
This process is referred to as: **concatenation**.
9+
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.
1010

11-
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.
11+
In Python, you can concatenate, or join together, two or more strings using the `+` operator. This is how it works:
1212

1313
```py
14+
1415
one = 'a'
1516
two = 'b'
16-
print(one+two); #this will print 'ab' on the console.
17+
print(one + two) # this will print 'ab' on the console.
1718
```
1819

19-
## 📝 Instructions:
20+
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.
21+
22+
## 📝 Instructions:
23+
1. Set the values for `my_var1` and `my_var2` so that when concatenated, the code prints `Hello World` in the console.
2024

21-
1. Set the values for `my_var1` and `my_var2` so the code prints `Hello World` in the console.
25+
## 💡 Hint:
26+
+ 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)

exercises/06-String-Concatenation/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Set the values for my_var1 and my_var2 here
1+
# ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅
22

33

44
## Don't change below this line

exercises/06-String-Concatenation/solution.hide.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Set the values for my_var1 and my_var2 here
1+
# ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅
2+
23
my_var1 = "Hello"
34
my_var2 = "World"
45

exercises/06-String-Concatenation/test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def test_my_var2_exists():
2020
@pytest.mark.it("Variable my_var1 value should be 'Hello'")
2121
def test_my_var1_value():
2222
from app import my_var1
23-
assert my_var1 == "Hello"
23+
assert my_var1.lower() == "hello"
2424

2525
@pytest.mark.it("Variable my_var2 value should be 'World'")
2626
def test_my_var2_value():
2727
from app import my_var2
28-
assert my_var2 == "World"
28+
assert my_var2.lower() == "world"
2929

3030
@pytest.mark.it("Variable my_var2 value should be 'World'")
3131
def test_the_new_string_exists():
@@ -38,4 +38,4 @@ def test_the_new_string_exists():
3838
@pytest.mark.it('Print "Hello World" on the console')
3939
def test_for_file_output():
4040
captured = buffer.getvalue()
41-
assert captured == "Hello World\n" #add \n because the console jumps the line on every print
41+
assert "hello world\n" in captured.lower() #add \n because the console jumps the line on every print

exercises/07-Create-a-Basic-HTML/app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
g = '<title>'
88
h = '<body>'
99

10-
# ⬆ DON'T CHANGE THE CODE ABOVE ⬆
11-
# ↓ start coding below here ↓
10+
# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌
11+
12+
# ✅ ↓ start coding below here ↓ ✅
1213

exercises/07-Create-a-Basic-HTML/solution.hide.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
g = '<title>'
88
h = '<body>'
99

10-
# ⬆ DON'T CHANGE THE CODE ABOVE ⬆
11-
# ↓ start coding below here ↓
10+
# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌
11+
12+
# ✅ ↓ start coding below here ↓ ✅
1213

1314
html_document = e+c+g+a+f+h+d+b
1415
print(html_document)

exercises/07-Create-a-Basic-HTML/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_html_document_exists():
1313
def test_html_document_exists():
1414
try:
1515
from app import html_document
16-
assert html_document == '<html><head><title></title></head><body></body></html>'
16+
assert html_document == '<html><head><title></title></head><body></body></html>'
1717
except ImportError:
1818
raise ImportError("The variable 'html_document' should exist on app.py")
1919

@@ -30,4 +30,4 @@ def test_for_concat():
3030
@pytest.mark.it('Print a basic html layout on the console like this: <html><head><title></title></head><body></body></html>')
3131
def test_for_file_output():
3232
captured = buffer.getvalue()
33-
assert captured == "<html><head><title></title></head><body></body></html>\n" #add \n because the console jumps the line on every print
33+
assert "<html><head><title></title></head><body></body></html>\n" in captured #add \n because the console jumps the line on every print

exercises/08.1-Your-First-If/README.es.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ La aplicación actual está preguntando cuánto dinero tiene el usuario. Una vez
1515
+ Usa un condicional `if/else` para verificar el valor de la variable `total`.
1616

1717
+ Puedes leer más al respecto [aquí](https://docs.python.org/3/tutorial/controlflow.html#if-statements).
18+
19+
+ Aquí tienes un recordatorio sobre los operadores relacionales:
20+
21+
| Operador | Descripción | Sintaxis |
22+
|----------|------------------------------------------------------------------------------|----------|
23+
| > | Mayor que: Verdadero si el operando izquierdo es mayor que el derecho | x > y |
24+
| < | Menor que: Verdadero si el operando izquierdo es menor que el derecho | x < y |
25+
| == | Igual a: Verdadero si ambos operandos son iguales | x == y |
26+
| != | No igual a – Verdadero si los operandos no son iguales | x != y |
27+
| >= | Mayor o igual que: Verdadero si el operando izquierdo es mayor o igual | x >= y |
28+
| <= | Menor o igual que: Verdadero si el operando izquierdo es menor o igual | x <= y |

exercises/08.1-Your-First-If/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tutorial: "https://www.youtube.com/watch?v=x9wqa5WQZiM"
44

55
# `08.1` Your First if...
66

7-
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:
7+
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:
88

99
## 📝 Instructions:
1010

@@ -19,3 +19,14 @@ The current application is prompting asking how much money the user has. Once th
1919
+ Use an If/else statement to check the value of the `total` variable.
2020

2121
+ Further information [here](https://docs.python.org/3/tutorial/controlflow.html#if-statements).
22+
23+
+ Here's a quick reminder on relational operators:
24+
25+
| Operator | Description | Syntax |
26+
|----------|--------------------------------------------------------------------|-----------|
27+
| > | Greater than: True if the left operand is greater than the right | x > y |
28+
| < | Less than: True if the left operand is less than the right | x < y |
29+
| == | Equal to: True if both operands are equal | x == y |
30+
| != | Not equal to – True if operands are not equal | x != y |
31+
| >= | Greater than or equal to: True if left operand is greater or equal | x >= y |
32+
| <= | Less than or equal to: True if left operand is less than or equal | x <= y |

exercises/08.1-Your-First-If/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
total = int(input('How much money do you have in your pocket\n'))
22

3-
# YOUR CODE HERE
3+
# ✅ ↓ YOUR CODE HERE ↓ ✅

0 commit comments

Comments
 (0)