Skip to content

exercises 05-user-inputed-values to 19-bottles-of-milk #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 101 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
bd1cc16
Update README.md
josemoracard Nov 22, 2023
84a73ae
Update README.es.md
josemoracard Nov 22, 2023
61d013a
Update test.py
josemoracard Nov 22, 2023
8f23d1b
Update README.md
josemoracard Nov 22, 2023
42e0a96
Update README.es.md
josemoracard Nov 22, 2023
2c1348b
Update solution.hide.py
josemoracard Nov 22, 2023
67dd580
Update app.py
josemoracard Nov 22, 2023
e2f3dc7
Update test.py
josemoracard Nov 22, 2023
1159d31
Update README.md
josemoracard Nov 22, 2023
c8fe037
Update README.es.md
josemoracard Nov 22, 2023
2405e34
Update solution.hide.py
josemoracard Nov 22, 2023
aa99cc6
Update README.md
josemoracard Nov 22, 2023
cc1a413
Update README.md
josemoracard Nov 22, 2023
91a56da
Update README.md
josemoracard Nov 22, 2023
85d3a8a
Update README.es.md
josemoracard Nov 22, 2023
2b5a542
Update solution.hide.py
josemoracard Nov 22, 2023
2a87fe5
Update test.py
josemoracard Nov 22, 2023
d634922
Update README.es.md
josemoracard Nov 22, 2023
7617dba
Update README.md
josemoracard Nov 22, 2023
d05cff0
Update README.es.md
josemoracard Nov 22, 2023
dbf1d96
Update test.py
josemoracard Nov 22, 2023
8665301
Update README.md
josemoracard Nov 22, 2023
b2fd154
Update README.md
josemoracard Nov 22, 2023
30e21f0
Update README.es.md
josemoracard Nov 22, 2023
8164724
Update README.md
josemoracard Nov 22, 2023
cabc386
Update README.md
josemoracard Nov 22, 2023
2da2289
Update README.md
josemoracard Nov 22, 2023
9a72514
Update README.es.md
josemoracard Nov 22, 2023
5d2be4a
Update test.py
josemoracard Nov 22, 2023
204f6c3
Update README.md
josemoracard Nov 22, 2023
efc1e48
Update README.es.md
josemoracard Nov 22, 2023
9aca335
Update app.py
josemoracard Nov 22, 2023
32e714b
Update app.py
josemoracard Nov 22, 2023
6182cc6
Update solution.hide.py
josemoracard Nov 22, 2023
3161d75
Update test.py
josemoracard Nov 22, 2023
688a962
Update README.md
josemoracard Nov 22, 2023
79f4de7
Update README.md
josemoracard Nov 22, 2023
bf3ae00
Update README.es.md
josemoracard Nov 22, 2023
285c2cd
Update app.py
josemoracard Nov 22, 2023
b5bfb71
Update solution.hide.py
josemoracard Nov 22, 2023
7ab26ae
Update test.py
josemoracard Nov 22, 2023
40a46fe
Update solution.hide.py
josemoracard Nov 22, 2023
0b2f484
Update test.py
josemoracard Nov 22, 2023
dbca2ef
Update README.md
josemoracard Nov 22, 2023
1719e25
Update README.es.md
josemoracard Nov 22, 2023
9c5cae8
Update app.py
josemoracard Nov 22, 2023
4bbb22b
Update solution.hide.py
josemoracard Nov 22, 2023
a9778d7
Update test.py
josemoracard Nov 22, 2023
b88cf30
Update test.py
josemoracard Nov 22, 2023
018eba7
Update README.es.md
josemoracard Nov 22, 2023
4a60088
Update README.md
josemoracard Nov 22, 2023
cbec791
Update README.es.md
josemoracard Nov 22, 2023
3f2d1d0
Update solution.hide.py
josemoracard Nov 22, 2023
e8b97f9
Update app.py
josemoracard Nov 22, 2023
edd0145
Update test.py
josemoracard Nov 22, 2023
e6a5c2f
Update README.md
josemoracard Nov 22, 2023
d10de54
Update README.es.md
josemoracard Nov 22, 2023
116f2dd
Update README.md
josemoracard Nov 22, 2023
e933add
Update test.py
josemoracard Nov 22, 2023
c1de882
Update README.md
josemoracard Nov 22, 2023
2cba5ed
Update README.es.md
josemoracard Nov 22, 2023
6c77594
Update app.py
josemoracard Nov 22, 2023
6b2f2e6
Update solution.hide.py
josemoracard Nov 22, 2023
60c281b
Update test.py
josemoracard Nov 22, 2023
ff89527
Update README.md
josemoracard Nov 22, 2023
c8261e2
Update README.md
josemoracard Nov 22, 2023
0ecb291
Update README.es.md
josemoracard Nov 22, 2023
55cb751
Update app.py
josemoracard Nov 22, 2023
0734f38
Update solution.hide.py
josemoracard Nov 22, 2023
e739b5f
Update test.py
josemoracard Nov 22, 2023
ab35dd0
Update README.md
josemoracard Nov 22, 2023
7ee1b5e
Update README.es.md
josemoracard Nov 22, 2023
744db6c
Update solution.hide.py
josemoracard Nov 22, 2023
66e30d1
Update app.py
josemoracard Nov 22, 2023
1e9dbcf
Update solution.hide.py
josemoracard Nov 22, 2023
0ee7f4d
Update README.md
josemoracard Nov 22, 2023
0e4a2e6
Update README.md
josemoracard Nov 22, 2023
3f6c929
Update README.md
josemoracard Nov 22, 2023
03e5a7a
Update README.es.md
josemoracard Nov 22, 2023
f732712
Update app.py
josemoracard Nov 22, 2023
61c7ab3
Update solution.hide.py
josemoracard Nov 22, 2023
8f9150b
Update README.md
josemoracard Nov 22, 2023
6e82e38
Update README.es.md
josemoracard Nov 22, 2023
7b6861a
Update test.py
josemoracard Nov 22, 2023
e1a6b38
Update solution.hide.py
josemoracard Nov 22, 2023
503c4a5
Update test.py
josemoracard Nov 22, 2023
01b8ae5
Update README.md
josemoracard Nov 22, 2023
18b75bf
Update README.es.md
josemoracard Nov 22, 2023
b39bbd6
Update README.es.md
josemoracard Nov 22, 2023
929a2e6
Update README.es.md
josemoracard Nov 22, 2023
9f51e09
Update README.md
josemoracard Nov 22, 2023
d681ed4
Update README.md
josemoracard Nov 22, 2023
59d6ad5
Update README.md
josemoracard Nov 22, 2023
3f03be9
Update README.es.md
josemoracard Nov 22, 2023
1ea67ed
Update README.md
josemoracard Nov 22, 2023
c3bc875
Update README.es.md
josemoracard Nov 22, 2023
2a3253f
Update app.py
josemoracard Nov 22, 2023
1169f9e
Update solution.hide.py
josemoracard Nov 22, 2023
77944ba
Update test.py
josemoracard Nov 22, 2023
2e37547
Update README.es.md
josemoracard Nov 22, 2023
e6a8af8
Update README.md
josemoracard Nov 22, 2023
48728ff
Update README.es.md
josemoracard Nov 22, 2023
4679f27
Update solution.hide.py
josemoracard Nov 22, 2023
f0443fc
Update README.md
josemoracard Nov 22, 2023
fcd7bdb
Update README.es.md
josemoracard Nov 22, 2023
597414d
Merge branch 'master' into jose4-05-user-inputed-values
alesanchezr Dec 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions exercises/05-User-Inputed-Values/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

Otra cosa genial de las variables es que no necesitas saber su valor para poder trabajar con ellas.

Por ejemplo, justo ahora la aplicación está preguntando la edad del usuario, y luego la imprime en la cónsola.
Por ejemplo, justo ahora la aplicación está preguntando la edad del usuario, y luego la imprime en la consola.

## 📝 Instrucciones:

1. Por favor, añade 10 años al valor de la variable `age`.

## 💡 Pista:
## 💡 Pistas:

+ Puedes buscar en Google "Como sumarle una cantidad a una variable de Python".

+ Recuerda que el contenido de la variable está siendo definido con lo que sea que el usuario coloque.
+ Recuerda que el contenido de la variable está siendo definido con lo que sea que el usuario coloque.
6 changes: 3 additions & 3 deletions exercises/05-User-Inputed-Values/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ For example, the application right now is prompting the user for its age, and th

1. Please add 10 years to the value of the age variable.

## 💡Hint
## 💡 Hints:

+ You can Google "how to add a number to a python variable".
+ You can Google "how to add a number to a Python variable".

+ Remember that the content of the variable its being previously filled with whatever the user inputs.
+ Remember that the content of the variable is being previously filled with whatever the user inputs.
2 changes: 1 addition & 1 deletion exercises/05-User-Inputed-Values/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_for_file_output(capsys):
regex = re.compile(pattern)
assert bool(regex.search(content)) == True

@pytest.mark.it("We tried with age 50 and it was supposed to return 60")
@pytest.mark.it("Testing with age 50 and it is supposed to return 60")
@mock.patch('builtins.input', lambda x: 50)
def test_plus_ten(stdin):
# f = open(os.path.dirname(os.path.abspath(__file__))+'/app.py')
Expand Down
5 changes: 2 additions & 3 deletions exercises/06-String-Concatenation/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ Puedes pensar en este proceso como conectar dos o más vagones de tren. Si cada
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.
```

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.
Expand All @@ -20,4 +19,4 @@ Aquí, las variables `one` y `two` contienen los strings individuales `'a'` y `'


## 💡 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)
+ Si necesitas más explicación sobre como funciona la **concatenación** en Python, puedes ver este clip: https://www.youtube.com/watch?v=T1nyPuAhd1U&ab_channel=ProgramaResuelto (`ctrl + click` en el enlace para abrir el video)
7 changes: 3 additions & 4 deletions exercises/06-String-Concatenation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ You can think of this process as similar to connecting two or more train cars. I
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.
```

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 that, when concatenated, the code prints `Hello World` in the console.

## 💡 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)
+ 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)
6 changes: 3 additions & 3 deletions exercises/06-String-Concatenation/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅


## Don't change below this line
the_new_string = my_var1+' '+my_var2
print(the_new_string)
## Don't change anything below this line
the_new_string = my_var1 + ' ' + my_var2
print(the_new_string)
6 changes: 3 additions & 3 deletions exercises/06-String-Concatenation/solution.hide.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
my_var1 = "Hello"
my_var2 = "World"

## Don't change below this line
the_new_string = my_var1+' '+my_var2
print(the_new_string)
## Don't change anything below this line
the_new_string = my_var1 + ' ' + my_var2
print(the_new_string)
4 changes: 2 additions & 2 deletions exercises/06-String-Concatenation/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_my_var2_value():
from app import my_var2
assert my_var2.lower() == "world"

@pytest.mark.it("Variable my_var2 value should be 'World'")
@pytest.mark.it("Don't remove the_new_string variable")
def test_the_new_string_exists():
import app
try:
Expand All @@ -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 "hello world\n" in captured.lower() #add \n because the console jumps the line on every print
assert "hello world\n" in captured.lower() #add \n because the console jumps the line on every print
10 changes: 4 additions & 6 deletions exercises/07-Create-a-Basic-HTML/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ Continuemos concatenando strings para generar un documento HTML básico...

## 📝 Instrucciones:

1. Crea una variable **html_document**.
1. Crea la variable `html_document`.

2. El código a la izquierda contiene 8 variables con diferentes valores de tipo *string*. Por favor, usa las variables concatenándolas entre ellas para establecer el valor de la variable **html_document** como nuevo string que tenga el contenido de un documento HTML típico (con las etiquetas HTML
en el orden correcto).
2. El código a la izquierda contiene 8 variables con diferentes valores de tipo *string*. Por favor, usa las variables concatenándolas entre ellas para establecer el valor de la variable `html_document` a la estructura típica de un documento HTML (con las etiquetas HTML en el orden correcto).

3. Luego, imprime el valor de **html_document** en la consola.
3. Luego, imprime el valor de `html_document` en la consola.

## 💡 Pista:

+ Resultado esperado:

```sh

```html
<html><head><title></title></head><body></body></html>
```

14 changes: 6 additions & 8 deletions exercises/07-Create-a-Basic-HTML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@
tutorial: "https://www.youtube.com/watch?v=j14V-eS8mRg"
---

# `07` Create a basic HTML
# `07` Create a Basic HTML

Let's continue using string concatenation to generate HTML...

## 📝 Instructions:

1. Create a variable **html_document**.
1. Create the variable `html_document`.

2. The code on the left contains 8 variables with different string values, please use the variables concatenating them together to set the value of the variable **html_document**
a new string that has the content of a typical HTML document (with the HTML tags in the
right order).
2. The code on the left contains 8 variables with different string values, please use the variables concatenating them together to set the value of the variable `html_document`
to a new string that has the content of a typical HTML document (with the HTML tags in the right order).

3. Then, print the value of **html_document** on the console.
3. Then, print the value of `html_document` on the console.

## 💡 Hint:

+ Expected Result:

```sh

```html
<html><head><title></title></head><body></body></html>
```

4 changes: 2 additions & 2 deletions exercises/07-Create-a-Basic-HTML/solution.hide.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

# ✅ ↓ start coding below here ↓ ✅

html_document = e+c+g+a+f+h+d+b
print(html_document)
html_document = e + c + g + a + f + h + d + b
print(html_document)
20 changes: 10 additions & 10 deletions exercises/08.1-Your-First-If/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ La aplicación actual está preguntando cuánto dinero tiene el usuario. Una vez

## 📝 Instrucciones:

1. Si el usuario tiene más de $100, respondemos: "Give me your money!" (Dame tu dinero).
1. Si el usuario tiene más de $100, respondemos: "Give me your money!" (¡Dame tu dinero!).

2. Si el usuario tiene más de $50, respondemos: "Buy me some coffee you cheap!" (¡Comprame un café!).
2. Si el usuario tiene más de $50, respondemos: "Buy me some coffee, you cheap!" (¡Cómprame un café!).

3. Si el usuario tiene igual o menos de $50, respondemos: "You are a poor guy, go away!" (¡Eres pobre!).

## 💡 Pista:
## 💡 Pistas:

+ Usa un condicional `if/else` para verificar el valor de la variable `total`.
+ 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 |
| > | Mayor que: True si el operando izquierdo es mayor que el derecho | x > y |
| < | Menor que: True si el operando izquierdo es menor que el derecho | x < y |
| == | Igual a: True si ambos operandos son iguales | x == y |
| != | No igual a: True si los operandos no son iguales | x != y |
| >= | Mayor o igual que: True si el operando izquierdo es mayor o igual | x >= y |
| <= | Menor o igual que: True si el operando izquierdo es menor o igual | x <= y |
26 changes: 13 additions & 13 deletions exercises/08.1-Your-First-If/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
tutorial: "https://www.youtube.com/watch?v=x9wqa5WQZiM"
---

# `08.1` Your First if...
# `08.1` Your First If...

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:

1. If the user has more than $100, we answer: "Give me your money!".

2. If the user has more than $50, we answer: "Buy me some coffee you cheap!".
2. If the user has more than $50, we answer: "Buy me some coffee, you cheap!".

3. If the user has less or equal than $50, we answer: "You are a poor guy, go away!".
3. If the user has less than or equal to $50, we answer: "You are a poor guy, go away!".

## 💡 Hint:
## 💡 Hints:

+ Use an If/else statement to check the value of the `total` variable.
+ 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 toTrue 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 |
| 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 the left operand is greater or equal | x >= y |
| <= | Less than or equal to: True if the left operand is less or equal | x <= y |
4 changes: 2 additions & 2 deletions exercises/08.1-Your-First-If/solution.hide.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
if total > 100:
print("Give me your money!")
elif total > 50:
print("Buy me some coffee you cheap!")
print("Buy me some coffee, you cheap!")
else:
print("You are a poor guy, go away!")
print("You are a poor guy, go away!")
18 changes: 9 additions & 9 deletions exercises/08.1-Your-First-If/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,37 @@ def test_for_output_when_101(stdin, capsys, app):
captured = capsys.readouterr()
assert "Give me your money!\n" in captured.out

@pytest.mark.it("When input exactly 100 should print: Buy me some coffee you cheap ")
@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" in 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 ")
@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" in 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 ")
@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" in 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")
@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" in captured.out

@pytest.mark.it("When input less than 50 should print: You are a poor guy, go away")
@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" in captured.out
assert "You are a poor guy, go away!\n" in captured.out
8 changes: 4 additions & 4 deletions exercises/08.2-How-Much-The-Wedding-Costs/README.es.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `08.2` Cuánto costará la boda (if...else)
# `08.2` How Much The Wedding Costs (if...else)

Aquí tenemos una tabla de precios de una compañía de catering de bodas:

Expand All @@ -9,16 +9,16 @@ 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.
> Nota: Las cantidades en la tabla incluyen el número especificado. Por ejemplo, "Hasta 50 personas" incluye exactamente 50 personas.

## 📝 Instrucciones:

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.
Por ejemplo, si la persona dice que `20` personas van a la boda, debería costar `$4,000` dólares.

## 💡 Pista:

+ Usa if/else para dividir el código y definir el valor de la variable `price` de forma correcta.
+ Usa `if...else` para dividir el código y definir el valor de la variable `price` de forma correcta.
2 changes: 1 addition & 1 deletion exercises/08.2-How-Much-The-Wedding-Costs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ For example, if the user says that `20` people are attending to the wedding, it

## 💡 Hint:

+ Use if/else to divide your code and set the value of the `price` variable the right way.
+ Use `if...else` to divide your code and set the value of the `price` variable the right way.
10 changes: 5 additions & 5 deletions exercises/08.2-How-Much-The-Wedding-Costs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ def test_for_print(capsys):
regex2 = re.compile(r"elif\s*")
assert bool(regex2.search(content)) == True

@pytest.mark.it("Between 101 and 199 guests sould be priced 15,000")
@pytest.mark.it("Between 101 and 199 guests, it should cost 15,000")
def test__between_100_and_200(capsys, app):
with mock.patch('builtins.input', lambda x: 199):
app()
captured = capsys.readouterr()
price = 15000
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")
@pytest.mark.it("Between 100 and 51 guests, it should cost 10,000")
def test_between_101_and_51(capsys, app):
with mock.patch('builtins.input', lambda x: 100):
app()
Expand All @@ -33,18 +33,18 @@ def test_between_101_and_51(capsys, app):
assert "Your wedding will cost "+str(price)+" dollars\n" in captured.out


@pytest.mark.it("Less than 50 guests sould be priced 4,000")
@pytest.mark.it("Less than 50 guests, it should cost 4,000")
def test_less_than_50(capsys, app):
with mock.patch('builtins.input', lambda x: 49):
app()
captured = capsys.readouterr()
price = 4000
"Your wedding will cost "+str(price)+" dollars\n" in captured.out

@pytest.mark.it("More than 200 should be priced 20,000")
@pytest.mark.it("More than 200 guests, it should cost 20,000")
def test_t(capsys, app):
with mock.patch('builtins.input', lambda x: 201):
app()
captured = capsys.readouterr()
price = 20000
"Your wedding will cost "+str(price)+" dollars\n" in captured.out
"Your wedding will cost "+str(price)+" dollars\n" in captured.out
Loading