diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 1a31f6b3..3d337c79 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,3 +1,4 @@
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
@@ -21,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "sudo apt-get update -y && sudo apt-get install xdg-utils -y && pip3 install pytest==6.2.5 pytest-testdox mock && npm i @learnpack/learnpack@2.1.47 -g && learnpack plugins:install @learnpack/python@1.0.3"
+ "onCreateCommand": "sudo apt-get update -y && sudo apt-get install xdg-utils -y && pip3 install pytest==6.2.5 pytest-testdox mock && npm i @learnpack/learnpack@4.0.10 -g && learnpack plugins:install @learnpack/python@1.0.3"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile
index 25ac192d..3de43aa2 100644
--- a/.gitpod.Dockerfile
+++ b/.gitpod.Dockerfile
@@ -25,4 +25,4 @@ RUN echo "unset DATABASE_URL" >> $HOME/.bashrc
RUN echo "export DATABASE_URL" >> $HOME/.bashrc
RUN pip3 install pytest==6.2.5 pytest-testdox mock
-RUN npm i @learnpack/learnpack@2.1.47 -g && learnpack plugins:install @learnpack/python@1.0.3
+RUN npm i @learnpack/learnpack@2.1.56 -g && learnpack plugins:install @learnpack/python@1.0.3
diff --git a/badge-python-bg.png b/.learn/assets/badge-python-bg.png
similarity index 100%
rename from badge-python-bg.png
rename to .learn/assets/badge-python-bg.png
diff --git a/preview.png b/.learn/assets/preview.png
similarity index 100%
rename from preview.png
rename to .learn/assets/preview.png
diff --git a/python-intro.gif b/.learn/assets/python-intro.gif
similarity index 100%
rename from python-intro.gif
rename to .learn/assets/python-intro.gif
diff --git a/.learn/assets/run-exercise.png b/.learn/assets/run-exercise.png
new file mode 100644
index 00000000..eb50a61a
Binary files /dev/null and b/.learn/assets/run-exercise.png differ
diff --git a/README.es.md b/README.es.md
index 5b2caf10..3172b5e7 100644
--- a/README.es.md
+++ b/README.es.md
@@ -1,7 +1,7 @@
# 馃悕 Tutorial y Ejercicios para Principiantes de Python
-Por @alesanchezr y otros colaboradores en 4Geeks Academy
+Por @alesanchezr y otros colaboradores en 4Geeks Academy
Esta serie en particular es para principiantes de Python. Aprender谩s los siguientes conceptos:
diff --git a/README.md b/README.md
index 661b029b..ffbcfff7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
+
# 馃悕 Python Beginner Tutorial and Exercises
diff --git a/exercises/00-Welcome/README.es.md b/exercises/00-Welcome/README.es.md
index 7b1b9591..3a0f5d91 100644
--- a/exercises/00-Welcome/README.es.md
+++ b/exercises/00-Welcome/README.es.md
@@ -1,3 +1,7 @@
+---
+intro: "https://www.youtube.com/watch?v=IXNSwnN-YqM"
+---
+
# Welcome to the Python Beginner Course!
隆Estamos muy entusiasmados por tenerte aqu铆! 馃帀 馃槀
diff --git a/exercises/01-Console/README.es.md b/exercises/01-Console/README.es.md
index 46371ece..22e276e0 100644
--- a/exercises/01-Console/README.es.md
+++ b/exercises/01-Console/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=z6OnN4s__TU"
+---
+
# `01` Console
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".
@@ -20,6 +24,6 @@ print("Un texto en la consola")
+ 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:
-
+
+ Si茅ntete libre de intentar otras cosas tambi茅n.
diff --git a/exercises/01-Console/README.md b/exercises/01-Console/README.md
index 8ccdcda4..7250c5cf 100644
--- a/exercises/01-Console/README.md
+++ b/exercises/01-Console/README.md
@@ -25,6 +25,6 @@ print("How are you?")
+ Remember, to run the code and see the output on the console, click on the box icon in the top left of the screen:
-
+
+ Feel free to try other things as well.
diff --git a/exercises/02-Declare-Variables/README.es.md b/exercises/02-Declare-Variables/README.es.md
index eaacd6fa..d6d228ac 100644
--- a/exercises/02-Declare-Variables/README.es.md
+++ b/exercises/02-Declare-Variables/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=FeSo8xlnrTI"
+---
+
# `02` Declare Variables
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:
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 12b5a6fd..fed43da0 100644
--- a/exercises/03-Print-Variables-In-The-Console/README.es.md
+++ b/exercises/03-Print-Variables-In-The-Console/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=SM71mzjuvfA"
+---
+
# `03` Print more Variables in The Console
Tambi茅n puedes imprimir m谩s de una variable en la misma funci贸n `print()` separando con una coma `,` las variables a imprimir. De esta manera:
diff --git a/exercises/04-Multiply-Two-Values/README.es.md b/exercises/04-Multiply-Two-Values/README.es.md
index a1f5dd5b..a80a49d4 100644
--- a/exercises/04-Multiply-Two-Values/README.es.md
+++ b/exercises/04-Multiply-Two-Values/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=p4PY8s6asfw"
+---
+
# `04` Multiply Two Values
Cualquier lenguaje de programaci贸n te permite realizar operaciones matem谩ticas b谩sicas como multiplicaci贸n, divisi贸n, etc.
diff --git a/exercises/05-User-Inputed-Values/README.es.md b/exercises/05-User-Inputed-Values/README.es.md
index ecbbf140..b3b5fb59 100644
--- a/exercises/05-User-Inputed-Values/README.es.md
+++ b/exercises/05-User-Inputed-Values/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=pe_DEzC-528"
+---
+
# `05` User Inputed Values
Otra cosa genial de las variables es que no necesitas saber su valor para poder trabajar con ellas.
diff --git a/exercises/06-String-Concatenation/README.es.md b/exercises/06-String-Concatenation/README.es.md
index 56b080d2..e7fcf43e 100644
--- a/exercises/06-String-Concatenation/README.es.md
+++ b/exercises/06-String-Concatenation/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=4y8xYy273f4"
+---
+
# `06` String Concatenation
La concatenaci贸n de strings es una tarea com煤n en la programaci贸n que implica combinar o unir dos o m谩s strings.
diff --git a/exercises/07-Create-a-Basic-HTML/README.es.md b/exercises/07-Create-a-Basic-HTML/README.es.md
index 0abe48b4..13fe96e8 100644
--- a/exercises/07-Create-a-Basic-HTML/README.es.md
+++ b/exercises/07-Create-a-Basic-HTML/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=zbTM_T6an4k"
+---
+
# `07` Create a Basic HTML
Continuemos concatenando strings para generar un documento HTML b谩sico...
diff --git a/exercises/08.1-Your-First-If/README.es.md b/exercises/08.1-Your-First-If/README.es.md
index b7ea9ac6..53295eda 100644
--- a/exercises/08.1-Your-First-If/README.es.md
+++ b/exercises/08.1-Your-First-If/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=n5skqOQfQ84"
+---
+
# `08.1` Your First If...
La aplicaci贸n actual est谩 preguntando cu谩nto dinero tiene el usuario. Una vez el usuario ingresa la cantidad, debemos 'imprimir' usando **print** una de las siguientes respuestas:
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 37b763c1..5658a3c0 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
@@ -1,3 +1,8 @@
+---
+tutorial: "https://www.youtube.com/watch?v=z3_0x8MlpFs"
+---
+
+
# `08.2` How Much The Wedding Costs (if...else)
Aqu铆 tenemos una tabla de precios de una compa帽铆a de catering de bodas:
diff --git a/exercises/09-Random-Numbers/README.es.md b/exercises/09-Random-Numbers/README.es.md
index b77ad09e..39fca4cd 100644
--- a/exercises/09-Random-Numbers/README.es.md
+++ b/exercises/09-Random-Numbers/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=9IjotW64sxA"
+---
+
# `09` Random Numbers
Puedes usar la funci贸n `randint()` para obtener un n煤mero entero aleatorio. `randint()` es una funci贸n interna del m贸dulo `random` en Python3.
diff --git a/exercises/10-Calling-Your-First-Function/README.es.md b/exercises/10-Calling-Your-First-Function/README.es.md
index 29bc48a1..c9627071 100644
--- a/exercises/10-Calling-Your-First-Function/README.es.md
+++ b/exercises/10-Calling-Your-First-Function/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=0Jxyc4eClNA"
+---
+
# `10` Calling Your First Function
Las funciones son incre铆bles por muchas cosas, pero principalmente porque puedes encapsular tu c贸digo en piezas y reusar esas piezas muchas veces sin tener que escribir todo el c贸digo cada vez.
diff --git a/exercises/10.1-Creating-Your-First-Function/README.es.md b/exercises/10.1-Creating-Your-First-Function/README.es.md
index 978f547f..47665d11 100644
--- a/exercises/10.1-Creating-Your-First-Function/README.es.md
+++ b/exercises/10.1-Creating-Your-First-Function/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=ePn8AzCG57Y"
+---
+
# `10.1` Creating Your First Function
## 馃摑 Instrucciones:
diff --git a/exercises/11-Create-A-New-Function/README.es.md b/exercises/11-Create-A-New-Function/README.es.md
index 05923095..affe02e8 100644
--- a/exercises/11-Create-A-New-Function/README.es.md
+++ b/exercises/11-Create-A-New-Function/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=6LhV15O9kvQ"
+---
+
# `11` Create a New Function
Como sabes, las funciones son un bloque de c贸digo 煤til que puedes reusar tantas veces como necesites.
diff --git a/exercises/11-Create-A-New-Function/test.py b/exercises/11-Create-A-New-Function/test.py
index 2872531b..964a103a 100644
--- a/exercises/11-Create-A-New-Function/test.py
+++ b/exercises/11-Create-A-New-Function/test.py
@@ -7,21 +7,25 @@
import mock
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
+
@pytest.mark.it('The function generate_random should exist')
def test_function_exists():
try:
from app import generate_random
except ImportError:
- raise ImportError("The function 'generate_random' should exist on app.py")
+ raise ImportError(
+ "The function 'generate_random' should exist on app.py")
+
@pytest.mark.it("The function 'generate_random' should return a random number between 0 and 9")
def test_for_return():
from app import generate_random
result = generate_random()
assert result is not None
- for x in range(0,20):
+ for x in range(0, 20):
result = generate_random()
- assert result <= 9 and result >= 0
+ assert result <= 9 and result >= 0
+
@pytest.mark.it('Use the function randinit() or randrange()')
def test_for_type_random():
@@ -29,12 +33,16 @@ def test_for_type_random():
content = content_file.read()
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
+ assert bool(regex.search(content)) == True or bool(
+ regex2.search(content)) == True
+
@pytest.mark.it('You should print() the output of the function')
def test_function_called_for():
-
- with open(path, 'r') as content_file:
- content = content_file.read()
- regex = re.compile(r"print\s*\(\s*generate_random\s*\(\s*\)\s*\)")
- assert bool(regex.search(content)) == True
+ captured_output = io.StringIO()
+ sys.stdout = captured_output
+ app.generate_random()
+ sys.stdout = sys.__stdout__
+ output = captured_output.getvalue()
+ regex = re.compile(r"\d{0,9}")
+ assert bool(regex.search(output)) == True
diff --git a/exercises/12-Rand-From-One-to-Twelve/README.es.md b/exercises/12-Rand-From-One-to-Twelve/README.es.md
index 995d8094..320f6776 100644
--- a/exercises/12-Rand-From-One-to-Twelve/README.es.md
+++ b/exercises/12-Rand-From-One-to-Twelve/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=tqZIlc1gVi8"
+---
+
# `12` Rand From One to Twelve
## 馃摑 Instrucciones:
diff --git a/exercises/13-Your-First-Loop/README.es.md b/exercises/13-Your-First-Loop/README.es.md
index 5749d0bd..5cc23101 100644
--- a/exercises/13-Your-First-Loop/README.es.md
+++ b/exercises/13-Your-First-Loop/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=0-vljraNvwE"
+---
+
# `13` Your First Loop
## 馃摑 Instrucciones:
diff --git a/exercises/14-Create-A-For-Loop/README.es.md b/exercises/14-Create-A-For-Loop/README.es.md
index 4dce8fc3..a7c29fd8 100644
--- a/exercises/14-Create-A-For-Loop/README.es.md
+++ b/exercises/14-Create-A-For-Loop/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=ckSAqxzi5vs"
+---
+
# `14` Create A For Loop
Los bucles o loops son muy 煤tiles. No tienes que reescribir las mismas l铆neas muchas veces.
diff --git a/exercises/15-Looping-With-FizzBuzz/README.es.md b/exercises/15-Looping-With-FizzBuzz/README.es.md
index fbaa200d..a64bd0fe 100644
--- a/exercises/15-Looping-With-FizzBuzz/README.es.md
+++ b/exercises/15-Looping-With-FizzBuzz/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=VkAccivrOPM"
+---
+
# `15` Looping With FizzBuzz
Esta es una t铆pica prueba de principiante que es exigida para las entrevistas en Google, Facebook y las dem谩s grandes compa帽铆as de tecnolog铆a.
diff --git a/exercises/16-Random-Colors-Loop/README.es.md b/exercises/16-Random-Colors-Loop/README.es.md
index 493f0c12..85106922 100644
--- a/exercises/16-Random-Colors-Loop/README.es.md
+++ b/exercises/16-Random-Colors-Loop/README.es.md
@@ -1,3 +1,8 @@
+---
+tutorial: "https://www.youtube.com/watch?v=jYK2i0_dtns"
+---
+
+
# `16` Random Colors (Loop)
Hemos creado una funci贸n que devuelve un color basado en un n煤mero entre 0 y 3 (cualquier otro n煤mero retornar谩 el color `black`).
diff --git a/exercises/17-Russian-Roulette/README.es.md b/exercises/17-Russian-Roulette/README.es.md
index 25da2194..54e19d2c 100644
--- a/exercises/17-Russian-Roulette/README.es.md
+++ b/exercises/17-Russian-Roulette/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=KqO8ebdqs5I"
+---
+
# `17` Russian Roulette
驴Has jugado a la ruleta rusa? 隆Es muy divertido! Si no pierdes... (隆隆隆muuuajajajaja!!!).
diff --git a/exercises/18-The-Beatles/README.es.md b/exercises/18-The-Beatles/README.es.md
index d0fa4cf3..e1aee34c 100644
--- a/exercises/18-The-Beatles/README.es.md
+++ b/exercises/18-The-Beatles/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=0Y2mHwwQBGE"
+---
+
# `18` The Beatles
驴A qui茅n no le gusta The Beatles?
diff --git a/exercises/18-The-Beatles/solution.hide.py b/exercises/18-The-Beatles/solution.hide.py
index 49901bf0..c907bc03 100644
--- a/exercises/18-The-Beatles/solution.hide.py
+++ b/exercises/18-The-Beatles/solution.hide.py
@@ -1,12 +1,13 @@
# 鉁呪啌 Write your code here 鈫撯渽
def sing():
+ song = ""
for i in range(11):
if i == 4:
- print("there will be an answer,")
+ song += "there will be an answer,\n"
elif i == 10:
- print("whisper words of wisdom, let it be")
+ song += "whisper words of wisdom, let it be"
else:
- print("let it be,")
- return None
+ song += "let it be,\n"
+ return song
sing()
diff --git a/exercises/19-Bottles-Of-Milk/README.es.md b/exercises/19-Bottles-Of-Milk/README.es.md
index 3df3fb1e..155e476e 100644
--- a/exercises/19-Bottles-Of-Milk/README.es.md
+++ b/exercises/19-Bottles-Of-Milk/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=iLH9Hg4PAmw"
+---
+
# `19` Bottles Of Milk
驴Has escuchado la canci贸n sobre las 99 botellas de leche? Es una gran canci贸n, para nada aburrida...
diff --git a/learn.json b/learn.json
index e2aaf2ef..04ab4536 100644
--- a/learn.json
+++ b/learn.json
@@ -1,26 +1,37 @@
+
{
- "slug": "python-beginner-programming-exercises",
- "title": {
- "us": "Learn Python Interactively (beginner)",
- "es": "Aprende Python Interactivamente (Principiante)"
- },
- "intro": "https://www.youtube.com/watch?v=amyDNhZwGJQ",
- "repository": "https://github.com/4GeeksAcademy/python-beginner-programming-exercises",
- "preview": "https://github.com/4GeeksAcademy/python-beginner-programming-exercises/blob/master/preview.png?raw=true",
- "description": {
- "us": "Python Exercises for beginners, from Hello World to variables, loops and a little bit of functions.",
- "es": "Ejercicios de Python para principiantos, desde Hello World hasta variables, ciclos y un poco de funciones."
- },
- "duration": 10,
- "difficulty": "easy",
- "videoSolutions": true,
- "projectType": "tutorial",
- "bugsLink": "https://github.com/learnpack/learnpack/issues/new",
- "graded": true,
- "language": "python3",
-
- "editor": {
- "version": "3.1.24"
- }
-
+"slug": "python-beginner-programming-exercises",
+"title": {
+ "us": "Learn Python Interactively (beginner)",
+ "es": "Aprende Python Interactivamente (Principiante)"
+},
+"intro": "https://www.youtube.com/watch?v=amyDNhZwGJQ",
+"repository": "https://github.com/4GeeksAcademy/python-beginner-programming-exercises",
+"preview": "https://github.com/4GeeksAcademy/python-beginner-programming-exercises/blob/master/.learn/assets/preview.png?raw=true",
+"description": {
+ "us": "Python Exercises for beginners, from Hello World to variables, loops and a little bit of functions.",
+ "es": "Ejercicios de Python para principiantos, desde Hello World hasta variables, ciclos y un poco de funciones."
+},
+"duration": 10,
+"difficulty": "easy",
+"videoSolutions": true,
+"projectType": "tutorial",
+"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
+"graded": true,
+"language": "python3",
+
+"editor": {
+ "version": "4.0"
+},
+"telemetry": {
+ "batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry"
+},
+"video": {
+ "intro": {
+ "es": "https://www.youtube.com/watch?v=IXNSwnN-YqM",
+ "en": "https://www.youtube.com/watch?v=amyDNhZwGJQ"
+ }
+}
+
+
}