├── .devcontainer
└── devcontainer.json
├── .github
└── workflows
│ └── learnpack-audit.yml
├── .gitignore
├── .gitpod.Dockerfile
├── .gitpod.yml
├── .learn
└── assets
│ ├── badge-python-bg.png
│ ├── preview.png
│ ├── python-intro.gif
│ └── run-exercise.png
├── .vscode
└── settings.json
├── LICENSE.md
├── README.es.md
├── README.md
├── exercises
├── 00-Welcome
│ ├── README.es.md
│ └── README.md
├── 01-Console
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 02-Declare-Variables
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 03-Print-Variables-In-The-Console
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 04-Multiply-Two-Values
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 05-User-Inputed-Values
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 06-String-Concatenation
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 07-Create-a-Basic-HTML
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 08.1-Your-First-If
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 08.2-How-Much-The-Wedding-Costs
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 09-Random-Numbers
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 10-Calling-Your-First-Function
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 10.1-Creating-Your-First-Function
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 11-Create-A-New-Function
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 12-Rand-From-One-to-Twelve
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 13-Your-First-Loop
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 14-Create-A-For-Loop
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 15-Looping-With-FizzBuzz
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 16-Random-Colors-Loop
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 17-Russian-Roulette
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
├── 18-The-Beatles
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
└── 19-Bottles-Of-Milk
│ ├── README.es.md
│ ├── README.md
│ ├── app.py
│ ├── solution.hide.py
│ └── test.py
└── learn.json
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 |
2 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the
3 | // README at: https://github.com/devcontainers/templates/tree/main/src/python
4 | {
5 | "name": "Python 3",
6 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
7 | "image": "mcr.microsoft.com/devcontainers/python:0-3.10",
8 | "features": {
9 | "ghcr.io/devcontainers/features/node:1": {
10 | "nodeGypDependencies": true,
11 | "version": "16"
12 | }
13 | },
14 | "customizations": {
15 | "vscode": {
16 | "settings": {
17 | "editor.defaultFormatter": "esbenp.prettier-vscode",
18 | "workbench.editorAssociations": {
19 | "*.md": "vscode.markdown.preview.editor"
20 | }
21 | },
22 | "extensions": ["learn-pack.learnpack-vscode"]
23 | }
24 | },
25 | "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@5.0.19 -g && learnpack plugins:install @learnpack/python@1.0.6"
26 |
27 | // Features to add to the dev container. More info: https://containers.dev/features.
28 | // "features": {},
29 |
30 | // Use 'forwardPorts' to make a list of ports inside the container available locally.
31 | // "forwardPorts": [],
32 |
33 | // Use 'postCreateCommand' to run commands after the container is created.
34 | // "postCreateCommand": "pip3 install --user -r requirements.txt",
35 |
36 | // Configure tool-specific properties.
37 | // "customizations": {},
38 |
39 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
40 | // "remoteUser": "root"
41 | }
42 |
--------------------------------------------------------------------------------
/.github/workflows/learnpack-audit.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3 |
4 | name: Learnpack audit
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | pull_request:
10 | branches: [ main ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | strategy:
18 | matrix:
19 | node-version: [20.x]
20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21 |
22 | steps:
23 | - uses: actions/checkout@v2
24 | - name: Use Node.js ${{ matrix.node-version }}
25 | uses: actions/setup-node@v2
26 | with:
27 | node-version: ${{ matrix.node-version }}
28 | - run: npm install @learnpack/learnpack@latest -g
29 | - run: learnpack audit
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore everything
2 | /*
3 |
4 | !.gitignore
5 | !.devcontainer
6 | !.devcontainer/*
7 | !.gitpod.yml
8 | !.gitpod.Dockerfile
9 | !learn.json
10 | !bc.json
11 | !README.md
12 | !README.es.md
13 | !.vscode
14 |
15 | !/exercises
16 | !/exercises/*
17 |
18 | *.pyc
19 | __pycache__/
20 | .pytest_cache/
21 |
22 | !/.learn
23 | /.learn/**
24 | !/.learn/resets
25 | !/.learn/resets/**
26 | !/.learn/assets
27 | !/.learn/assets/**
28 |
29 |
--------------------------------------------------------------------------------
/.gitpod.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM gitpod/workspace-full:latest
2 |
3 | SHELL ["/bin/bash", "-c"]
4 |
5 | RUN sudo apt-get update \
6 | && sudo apt-get update \
7 | && sudo apt-get clean \
8 | && sudo rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/*
9 |
10 | # That Gitpod install pyenv for me? no, thanks
11 | WORKDIR /home/gitpod/
12 | RUN rm .pyenv -Rf
13 | RUN rm .gp_pyenv.d -Rf
14 | RUN curl https://pyenv.run | bash
15 |
16 |
17 | RUN pyenv update && pyenv install 3.10.7 && pyenv global 3.10.7
18 | RUN pip install pipenv
19 |
20 | # remove PIP_USER environment
21 | USER gitpod
22 | RUN if ! grep -q "export PIP_USER=no" "$HOME/.bashrc"; then printf '%s\n' "export PIP_USER=no" >> "$HOME/.bashrc"; fi
23 | RUN echo "" >> $HOME/.bashrc
24 | RUN echo "unset DATABASE_URL" >> $HOME/.bashrc
25 | RUN echo "export DATABASE_URL" >> $HOME/.bashrc
26 |
27 | RUN pip3 install pytest==6.2.5 pytest-testdox mock
28 | RUN npm i @learnpack/learnpack@2.1.56 -g && learnpack plugins:install @learnpack/python@1.0.3
29 |
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | image:
2 | file: .gitpod.Dockerfile
3 |
4 | ports:
5 | - port: 3000
6 | onOpen: ignore
7 |
8 | vscode:
9 | extensions:
10 | - learn-pack.learnpack-vscode
11 |
12 |
13 | github:
14 | prebuilds:
15 | # enable for the master/default branch (defaults to true)
16 | master: true
17 | # enable for pull requests coming from this repo (defaults to true)
18 | pullRequests: false
19 | # add a "Review in Gitpod" button as a comment to pull requests (defaults to true)
20 | addComment: false
21 |
--------------------------------------------------------------------------------
/.learn/assets/badge-python-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/4GeeksAcademy/python-beginner-programming-exercises/fc351e4f61c8e1082e8cc98cd9304332c8fda0ad/.learn/assets/badge-python-bg.png
--------------------------------------------------------------------------------
/.learn/assets/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/4GeeksAcademy/python-beginner-programming-exercises/fc351e4f61c8e1082e8cc98cd9304332c8fda0ad/.learn/assets/preview.png
--------------------------------------------------------------------------------
/.learn/assets/python-intro.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/4GeeksAcademy/python-beginner-programming-exercises/fc351e4f61c8e1082e8cc98cd9304332c8fda0ad/.learn/assets/python-intro.gif
--------------------------------------------------------------------------------
/.learn/assets/run-exercise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/4GeeksAcademy/python-beginner-programming-exercises/fc351e4f61c8e1082e8cc98cd9304332c8fda0ad/.learn/assets/run-exercise.png
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.autoSave": "afterDelay",
3 | "files.autoSaveDelay": 700,
4 | "editor.minimap.enabled": false,
5 | "workbench.editorAssociations": {
6 | "*.md": "vscode.markdown.preview.editor"
7 | }
8 | }
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
2 |
3 | By accessing Breathe Code we assume you accept these terms and conditions. Do not continue to use Breathe Code's content, applications or tutorials if you do not agree to take all of the terms and conditions stated on this page.
4 |
5 | Unless otherwise stated, Breathe Code and/or its licensors own the intellectual property rights for all material on Breathe Code. All intellectual property rights are reserved. You may access this from Breathe Code for your own personal use subjected to restrictions set in these terms and conditions.
6 |
7 | You must not:
8 |
9 | * Republish material from Breathe Code
10 | * Sell, rent or sub-license material from Breathe Code
11 | * Reproduce, duplicate or copy material from Breathe Code
12 | * Redistribute content from Breathe Code
13 |
14 | You can read the full version of Breathe Code's terms and conditions here: [Terms and Conditions](http://breatheco.de/terms-and-conditions)
15 |
--------------------------------------------------------------------------------
/README.es.md:
--------------------------------------------------------------------------------
1 |
2 | # 🐍 Tutorial y Ejercicios para Principiantes de Python
3 |
4 | Por @alesanchezr y otros colaboradores en 4Geeks Academy
5 |
6 |
7 | Esta serie en particular es para principiantes de Python. Aprenderás los siguientes conceptos:
8 |
9 | 1. La función `print`.
10 |
11 | 2. Tipos de datos.
12 |
13 | 3. Listas y tuplas.
14 |
15 | 4. Funciones y diccionarios.
16 |
17 | Todo el tutorial es 👆 interactivo, ✅ calificado automáticamente, y con 📹 video tutoriales.
18 |
19 |
20 | ¡Te necesitamos! Estos ejercicios se crean y mantienen con colaboradores como tú. Si encuentras algún error o falta de ortografía, contribuye y/o infórmanos.
21 |
22 |
23 |
24 | ## Instalación en un clic (recomendado)
25 |
26 | Puedes empezar estos ejercicios en pocos segundos haciendo clic en: [Abrir en Codespaces](https://codespaces.new/?repo=4GeeksAcademy/python-beginner-programming-exercises) (recomendado) o [Abrir en Gitpod](https://gitpod.io#https://github.com/4GeeksAcademy/python-beginner-programming-exercises).
27 |
28 | > Una vez ya tengas abierto VSCode, los ejercicios de LearnPack deberían empezar automáticamente, si esto no sucede puedes intentar empezar los ejercicios escribiendo este comando en tu terminal: `$ learnpack start`
29 |
30 | ## Instalación local:
31 |
32 | 1. Asegúrate de instalar [LearnPack](https://learnpack.co), node.js version 14+ y Python version 3+. Este es el comando para instalar LearnPack:
33 |
34 | ```bash
35 | $ npm i @learnpack/learnpack@2.1.20 -g && learnpack plugins:install @learnpack/python@1.0.0
36 | ```
37 |
38 | 2. Clona o descarga este repositorio en tu ambiente local.
39 |
40 | ```bash
41 | $ git clone https://github.com/4GeeksAcademy/python-beginner-programming-exercises.git
42 | $ cd python-beginner-programming-exercises
43 | ```
44 |
45 | > Nota: Una vez que termine de descargar, encontrarás la carpeta "exercises" que contiene todos los ejercicios.
46 |
47 | 3. Inicializa el tutorial ejecutando el siguiente comando al mismo nivel en el que se encuentra tu archivo learn.json:
48 |
49 | ```bash
50 | $ pip3 install pytest==6.2.5 pytest-testdox mock
51 | $ learnpack start
52 | ```
53 |
54 |
55 |
56 |
57 | ## ¿Cómo están organizados los ejercicios?
58 |
59 | Cada ejercicio es una pequeña aplicación de Python que contiene los siguientes archivos:
60 |
61 | 1. **app.py:** representa el archivo de entrada de Python que será ejecutado por el computador.
62 | 2. **README.es.md:** Contiene las instrucciones del ejercicio.
63 | 3. **test.py:** Contiene el script del test para el ejercicio (no es necesario que abras este archivo).
64 |
65 | > Nota: Estos ejercicios tienen calificación automática. Los tests son muy rígidos y estrictos, mi recomendación es que no prestes demasiada atención a los tests y los uses solo como una sugerencia o podrías frustrarte.
66 |
67 | ## Colaboradores
68 |
69 | Gracias a estas personas maravillosas ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
70 |
71 | 1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribución: (programador) 💻 (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 👀, (build-tutorial) ✅, (documentación) 📖
72 |
73 | 2. [Paolo (plucodev)](https://github.com/plucodev), contribución: (bug reports) 🐛, (programador) 💻, (traducción) 🌎
74 |
75 | Este proyecto sigue la especificación [all-contributors](https://github.com/kentcdodds/all-contributors). ¡Todas las contribuciones son bienvenidas!
76 |
77 | Este y otros ejercicios son usados para [aprender a programar](https://4geeksacademy.com/es/aprender-a-programar/aprender-a-programar-desde-cero) por parte de los alumnos de 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/us/coding-bootcamp) realizado por [Alejandro Sánchez](https://twitter.com/alesanchezr) y muchos otros contribuyentes. Conoce más sobre nuestros [Cursos de Programación](https://4geeksacademy.com/es/curso-de-programacion-desde-cero?lang=es) para convertirte en [Full Stack Developer](https://4geeksacademy.com/es/coding-bootcamps/desarrollador-full-stack/?lang=es), o nuestro [Data Science Bootcamp](https://4geeksacademy.com/es/coding-bootcamps/curso-datascience-machine-learning).
78 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | # 🐍 Python Beginner Tutorial and Exercises
6 | By [@alesanchezr](https://twitter.com/alesanchezr) and [other contributors](https://github.com/4GeeksAcademy/python-beginner-programming-exercises/graphs/contributors) at [4Geeks Academy](http://4geeksacademy.com)
7 |
8 |
9 |
10 | *Estas instrucciones [están disponibles en 🇪🇸 español](https://github.com/4GeeksAcademy/python-beginner-programming-exercises/blob/master/README.es.md) :es:*
11 |
12 |
13 | These exercises are the ideal first step for anyone trying to learn Python. We start with the most simple challenge, like printing a message on the terminal and slowly increase step by step.
14 |
15 | This particular series is for Python beginners. You will learn:
16 |
17 | 1. The `print` function.
18 |
19 | 2. Data-Types.
20 |
21 | 3. Lists and Tuples.
22 |
23 | 4. Functions and dictionaries.
24 |
25 | The entire tutorial is 👆 interactive, ✅ auto-graded, and has 📹 video tutorials.
26 |
27 | These exercises were built in collaboration, we need you! If you find any bugs or misspellings please contribute and report them.
28 |
29 |
30 |
31 | ## One click installation (recommended):
32 |
33 | You can open these exercises in just a few seconds by clicking: [Open in Codespaces](https://codespaces.new/?repo=4GeeksAcademy/python-beginner-programming-exercises) (recommended) or [Open in Gitpod](https://gitpod.io#https://github.com/4GeeksAcademy/python-beginner-programming-exercises).
34 |
35 | > Once you have VSCode open, the LearnPack exercises should start automatically. If exercises don't run automatically, you can try typing on your terminal: `$ learnpack start`
36 |
37 | ## Local Installation
38 |
39 | 1. Make sure you have [LearnPack](https://learnpack.co) installed, node.js version 14+, and Python version 3+. This is the command to install LearnPack:
40 |
41 | ```bash
42 | $ npm i @learnpack/learnpack@2.1.20 -g && learnpack plugins:install @learnpack/python@1.0.0
43 | ```
44 |
45 | 2. Clone or download this repository in your local environment.
46 |
47 | ```bash
48 | $ git clone https://github.com/4GeeksAcademy/python-beginner-programming-exercises.git
49 | $ cd python-beginner-programming-exercises
50 | ```
51 |
52 | > Note: Once you finish downloading, you will find an "exercises" folder that contains all the exercises within.
53 |
54 | 3. Start the tutorial/exercises by running the following command at the same level where your learn.json file is:
55 |
56 | ```bash
57 | $ pip3 install pytest==6.2.5 pytest-testdox mock
58 | $ learnpack start
59 | ```
60 |
61 |
62 |
63 | ## How are the exercises organized?
64 |
65 | Each exercise is a small Python application containing the following files:
66 |
67 | 1. **app.py:** represents the entry Python file that will be executed by the computer.
68 | 2. **README.md:** contains exercise instructions.
69 | 3. **test.py:** you don't have to open this file, it contains the testing script for the exercise.
70 |
71 | > Note: The exercises have automatic grading, but it's very rigid and strict, my recommendation is to not take the tests too serious and use them only as a suggestion, or you may get frustrated.
72 |
73 | ## Contributors
74 |
75 | Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
76 |
77 | 1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 👀, (build-tutorial) ✅, (documentation) 📖
78 |
79 | 2. [Paolo (plucodev)](https://github.com/plucodev), contribution: (bug reports) 🐛, (coder) 💻, (translation) 🌎
80 |
81 | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!
82 |
83 | This and many other exercises are built by students as part of the 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/us/coding-bootcamp) by [Alejandro Sánchez](https://twitter.com/alesanchezr) and many other contributors. Find out more about our [Full Stack Developer Course](https://4geeksacademy.com/us/coding-bootcamps/part-time-full-stack-developer), and [Data Science Bootcamp](https://4geeksacademy.com/us/coding-bootcamps/datascience-machine-learning).
84 |
--------------------------------------------------------------------------------
/exercises/00-Welcome/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | intro: "https://www.youtube.com/watch?v=IXNSwnN-YqM"
3 | ---
4 |
5 | # Bienvenid@ al curso de Python para principiantes!
6 |
7 | ¡Estamos muy entusiasmados por tenerte aquí! 🎉 😂
8 |
9 | ## 💬 Fundamentos:
10 |
11 | Durante este curso aprenderás los siguientes conceptos:
12 |
13 | 1. Cómo crear y llamar funciones.
14 |
15 | 2. Cómo crear y llamar variables.
16 |
17 | 3. Cómo concatenar strings.
18 |
19 | 4. Cómo usar bucles (loops) y declaraciones if...else.
20 |
21 | 5. Cómo combinar y usar todos estos conceptos de diferentes formas.
22 |
23 | Por favor, haz clic en el botón `Next →` arriba a la derecha para dirigirte al primer ejercicio.
24 |
25 | ## Lecturas Útiles:
26 |
27 | + [https://datademia.es/blog/que-es-python](https://datademia.es/blog/que-es-python)
28 |
29 | + [https://www.capacitarte.org/blog/nota/que-es-y-para-que-sirve-python](https://www.capacitarte.org/blog/nota/que-es-y-para-que-sirve-python)
30 |
31 | ## Video Útil:
32 |
33 | + [https://youtu.be/lc5JJTQa4r8](https://youtu.be/lc5JJTQa4r8)
34 |
35 | ## Colaboradores:
36 |
37 | Gracias a estas maravillosas personas ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
38 |
39 | 1. [Alejandro Sánchez (alesanchezr)](https://github.com/alesanchezr), contribución: (programador) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 🤓, (build-tutorial) ✅, (documentación) 📖
40 |
41 | 2. [Paolo Lucano (plucodev)](https://github.com/plucodev), contribución: (programador) 💻, (build-tests) ⚠️
42 |
43 | 3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribución: (traducción) 🌎
44 |
45 | Este proyecto sigue las especificaciones: [all-contributors](https://github.com/kentcdodds/all-contributors).
46 |
47 | ¡Todas las contribuciones son bienvenidas!
48 |
--------------------------------------------------------------------------------
/exercises/00-Welcome/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | intro: "https://www.youtube.com/watch?v=amyDNhZwGJQ"
3 | ---
4 |
5 | # Welcome to the Python Beginner Course!
6 |
7 | We are very excited to have you here! 🎉 😂
8 |
9 | ## 💬 Fundamentals:
10 |
11 | During this course, you will be learning the following concepts:
12 |
13 | 1. How to create and call functions.
14 |
15 | 2. How to create and call variables.
16 |
17 | 3. How to concatenate strings.
18 |
19 | 4. How to use loops and if statements.
20 |
21 | 5. How to combine and use all these concepts in different ways.
22 |
23 | Please click on the `Next →` button on the top right to proceed to the first challenge.
24 |
25 | ## Useful Readings:
26 |
27 | + [https://www.w3schools.com/python/python_intro.asp](https://www.w3schools.com/python/python_intro.asp)
28 |
29 | + [https://www.python.org/doc/essays/blurb/](https://www.python.org/doc/essays/blurb/)
30 |
31 | ## Useful Video:
32 |
33 | + [https://youtu.be/Y8Tko2YC5hA](https://youtu.be/Y8Tko2YC5hA)
34 |
35 | ## Contributors:
36 |
37 | Thanks to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
38 |
39 | 1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 🤓, (build-tutorial) ✅, (documentation) 📖
40 |
41 | 2. [Paolo Lucano (plucodev)](https://github.com/plucodev), contribution: (coder) 💻, (build-tests) ⚠️
42 |
43 | 3. [Marco Gómez (marcogonzalo)](https://github.com/marcogonzalo), contribution: (translator) 🌎
44 |
45 |
46 | This project follows these specifications: [all-contributors](https://github.com/kentcdodds/all-contributors)
47 |
48 |
49 | Contributions of any kind are welcome!
50 |
--------------------------------------------------------------------------------
/exercises/01-Console/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=z6OnN4s__TU"
3 | ---
4 |
5 | # `01` Console
6 |
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".
8 |
9 | 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).
10 |
11 | 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.
12 |
13 | Este es un ejemplo de cómo usarla:
14 |
15 | ```py
16 | print("Un texto en la consola")
17 | ```
18 |
19 | ## 📝 Instrucciones:
20 |
21 | 1. Usa **print** para escribir `Hello World!` en la consola.
22 |
23 | ## 💡 Pistas:
24 |
25 | + 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:
26 |
27 | 
28 |
29 | + Siéntete libre de intentar otras cosas también.
30 |
--------------------------------------------------------------------------------
/exercises/01-Console/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=2sV-2frucUs"
3 | ---
4 |
5 | # `01` Console
6 |
7 | 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".
8 |
9 | Every programming language has a console, as it was the only way to interact with the users at the beginning (before Windows, Linux or macOS arrived).
10 |
11 | Today, printing in the console is mostly used as a monitoring and debugging tool, ideal for leaving a trace of the content of variables during the program's execution.
12 |
13 | This is an example of how to use it:
14 |
15 | ```py
16 | print("How are you?")
17 | ```
18 |
19 | ## 📝 Instructions:
20 |
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 | 
29 |
30 | + Feel free to try other things as well.
31 |
--------------------------------------------------------------------------------
/exercises/01-Console/app.py:
--------------------------------------------------------------------------------
1 | # print "Hello World!" on the console
--------------------------------------------------------------------------------
/exercises/01-Console/solution.hide.py:
--------------------------------------------------------------------------------
1 | # print "Hello World!" on the console
2 |
3 | print("Hello World!")
--------------------------------------------------------------------------------
/exercises/01-Console/test.py:
--------------------------------------------------------------------------------
1 | import io
2 | import sys
3 | sys.stdout = buffer = io.StringIO()
4 | import app
5 | import re
6 | import os
7 | import pytest
8 | path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
9 |
10 | @pytest.mark.it('Use the function print()')
11 | def test_for_file_output(capsys):
12 |
13 | with open(path, 'r') as content_file:
14 | content = content_file.read()
15 | pattern = r"print\s*\("
16 | regex = re.compile(pattern)
17 | assert bool(regex.search(content)) == True
18 |
19 | @pytest.mark.it('Print Hello World! on the console')
20 | def test_for_console_log(capsys):
21 | captured = buffer.getvalue()
22 | assert "Hello World!\n" in captured #add \n because the console jumps the line on every print
23 |
24 |
--------------------------------------------------------------------------------
/exercises/02-Declare-Variables/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=FeSo8xlnrTI"
3 | ---
4 |
5 | # `02` Declare Variables
6 |
7 | 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:
8 |
9 | ```py
10 | name = "Daniel"
11 | ```
12 |
13 | 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 guion 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.
14 |
15 | ## 📝 Instrucciones:
16 |
17 | 1. Declara una variable llamada `name` con el valor `"Yellow"` y luego imprímelo en la consola.
18 |
19 | 2. Luego, imprime su valor en la consola usando `print(name)`.
20 |
21 | ## 💡 Pistas:
22 |
23 | + El nombre de la variable debe ser `name` para pasar los tests y su valor tiene que ser el texto "Yellow".
24 |
25 | + 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 enlace para abrir el video)
26 |
--------------------------------------------------------------------------------
/exercises/02-Declare-Variables/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=dWWvZkaPwDw"
3 | ---
4 |
5 | # `02` Declare Variables
6 |
7 | In programming, we use variables like boxes (or containers) to store different kinds of information. Here's how to create a variable:
8 |
9 | ```py
10 | name = "Daniel"
11 | ```
12 |
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 |
15 | ## 📝 Instructions:
16 |
17 | 1. Declare a new variable named `name` with the string value `"Yellow"` and print the value to the console.
18 |
19 | 2. Then, print its value on the console using `print(name)`.
20 |
21 | ## 💡 Hints:
22 |
23 | + The variable's name must be `name` to pass the tests, and the value inside has to be the string "Yellow".
24 |
25 | + 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)
26 |
--------------------------------------------------------------------------------
/exercises/02-Declare-Variables/app.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ your code here ↓ ✅
2 |
--------------------------------------------------------------------------------
/exercises/02-Declare-Variables/solution.hide.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ your code here ↓ ✅
2 |
3 | color = "Yellow"
4 | print(color)
--------------------------------------------------------------------------------
/exercises/02-Declare-Variables/test.py:
--------------------------------------------------------------------------------
1 | import io
2 | import sys
3 | sys.stdout = buffer = io.StringIO()
4 | import app
5 | # from app import my_function
6 | import pytest
7 | import os
8 | import re
9 | path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
10 |
11 | @pytest.mark.it('Use the function print()')
12 | def test_for_print():
13 |
14 | with open(path, 'r') as content_file:
15 | content = content_file.read()
16 | regex = re.compile(r"print\s*\(['\"]?.+['\"]?\)")
17 | assert bool(regex.search(content)) == True
18 |
19 | @pytest.mark.it('Declare a variable and assign it the value "Yellow"')
20 | def test_for_variable():
21 |
22 | with open(path, 'r') as content_file:
23 | content = content_file.read()
24 | regex = re.compile(r"\w*(\s*)=(\s*)(\"|\')Yellow(\"|\')")
25 | assert bool(regex.search(content)) == True
26 |
27 | @pytest.mark.it('Print the variable on the console')
28 | def test_for_file_output(capsys):
29 | captured = buffer.getvalue()
30 | assert "Yellow\n" in captured #add \n because the console jumps the line on every print
31 |
32 |
33 |
--------------------------------------------------------------------------------
/exercises/03-Print-Variables-In-The-Console/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=SM71mzjuvfA"
3 | ---
4 |
5 | # `03` Print more Variables in The Console
6 |
7 | 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:
8 |
9 | ```py
10 | my_variable = 'hello'
11 | my_second_variable = "world"
12 | print(my_variable, my_second_variable) # --> hello world
13 | ```
14 |
15 | ## 📝 Instrucciones:
16 |
17 | 1. Declara dos nuevas variables llamadas `color` y `item` y asígnales el valor `"red"` y `marker` respectivamente.
18 |
19 | 2. Luego, imprime sus valores en la consola (puede que tengas que desplazarte en la consola para poder verlo).
20 |
--------------------------------------------------------------------------------
/exercises/03-Print-Variables-In-The-Console/README.md:
--------------------------------------------------------------------------------
1 | # `03` Print more Variables in the console
2 |
3 | You can also print more than one variable in the same `print()` function by separating the variables with a comma `,`. Like this:
4 |
5 | ```py
6 | my_variable = 'hello'
7 | my_second_variable = "world"
8 | print(my_variable, my_second_variable) # --> hello world
9 | ```
10 |
11 | ## 📝 Instructions:
12 |
13 | 1. Declare two new variables called `color` and `item`, and assign the value `"red"` and `"marker"` respectively to it.
14 |
15 | 2. Then, print their values on the console (you may have to scroll up in the terminal to see it!).
16 |
--------------------------------------------------------------------------------
/exercises/03-Print-Variables-In-The-Console/app.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ your code here ↓ ✅
--------------------------------------------------------------------------------
/exercises/03-Print-Variables-In-The-Console/solution.hide.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ your code here ↓ ✅
2 |
3 | color = "red"
4 | item = "marker"
5 | print(color, item)
6 |
--------------------------------------------------------------------------------
/exercises/03-Print-Variables-In-The-Console/test.py:
--------------------------------------------------------------------------------
1 | import io
2 | import sys
3 | sys.stdout = buffer = io.StringIO()
4 | # from app import my_function
5 | import pytest
6 | import app
7 | import os
8 |
9 | path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
10 |
11 | @pytest.mark.it("Create a variable named 'color' with the string value 'red'")
12 | def test_declare_variable():
13 | result = app.color
14 | assert result == "red"
15 |
16 | @pytest.mark.it("Create a variable named 'item' with the string value 'marker'")
17 | def test_declare_variable():
18 | result = app.item
19 | assert result == "marker"
20 |
21 | @pytest.mark.it('The printed value on the console should be "red marker"')
22 | def test_for_file_output(capsys):
23 | captured = buffer.getvalue()
24 | assert "red marker\n" in captured
25 |
--------------------------------------------------------------------------------
/exercises/04-Multiply-Two-Values/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=p4PY8s6asfw"
3 | ---
4 |
5 | # `04` Multiply Two Values
6 |
7 | Cualquier lenguaje de programación te permite realizar operaciones matemáticas básicas como multiplicación, división, etc.
8 |
9 | Para multiplicar dos valores en Python, tienes que usar el operador estrella o asterisco de esta forma:
10 |
11 | ```py
12 | resulting_value = 2 * 3
13 | ```
14 |
15 | En este caso, hemos almacenado el resultado de la multiplicación en una variable llamada `resulting_value`.
16 |
17 | ## 📝 Instrucciones:
18 |
19 | 1. Por favor, almacena el resultado de multiplicar 2345 por 7323 en una variable llamada `variables_are_cool`.
20 |
21 | 2. Ahora imprime el resultado en la consola.
--------------------------------------------------------------------------------
/exercises/04-Multiply-Two-Values/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=tATIrAWiLLU"
3 | ---
4 |
5 | # `04` Multiply Two Values
6 |
7 | Any programming language lets you do basic Math operations like multiplication, division, etc.
8 |
9 | To multiply 2 values in Python, you have to use the asterisk operator like this:
10 |
11 | ```py
12 | resulting_value = 2 * 3
13 | ```
14 |
15 | In this case, we stored the resulting value of the multiplication into a variable called `resulting_value`.
16 |
17 | ## 📝 Instructions:
18 |
19 | 1. Please store the result of multiplying 2345 times 7323 in a variable called `variables_are_cool`.
20 |
21 | 2. Now print the result in the console.
22 |
--------------------------------------------------------------------------------
/exercises/04-Multiply-Two-Values/app.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ your code here ↓ ✅
2 |
--------------------------------------------------------------------------------
/exercises/04-Multiply-Two-Values/solution.hide.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ your code here ↓ ✅
2 |
3 | variables_are_cool = 2345 * 7323
4 | print(variables_are_cool)
--------------------------------------------------------------------------------
/exercises/04-Multiply-Two-Values/test.py:
--------------------------------------------------------------------------------
1 | import io
2 | import sys
3 | sys.stdout = buffer = io.StringIO()
4 | # from app import my_function
5 | import pytest
6 | import os
7 | import app
8 | import re
9 | path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
10 |
11 | @pytest.mark.it('You should create a variable named variables_are_cool')
12 | def test_variable_exists():
13 | try:
14 | from app import variables_are_cool
15 | except ImportError:
16 | raise ImportError("The variable 'variables_are_cool' should exist on app.py")
17 |
18 | @pytest.mark.it('The value of variables_are_cool should be 2345 * 7323')
19 | def test_use_variable_name():
20 | result = app.variables_are_cool == 17172435
21 | assert result == True
22 |
23 | @pytest.mark.it('Print on the console the value of variables_are_cool')
24 | def test_for_file_output(capsys):
25 | captured = buffer.getvalue()
26 | assert '17172435\n' in captured
27 |
28 | @pytest.mark.it('Print on the console the variables_are_cool variable')
29 | def test_for_print():
30 | with open(path, 'r') as content_file:
31 | content = content_file.read()
32 | # makes sure we are calling print function with a variable and not the hard coded value
33 | regex = re.compile(r"print\s*\(\s*variables_are_cool\s*\)")
34 | assert bool(regex.search(content)) == True
35 |
36 | @pytest.mark.it('You should not hardcode the result')
37 | def test_for_print():
38 | with open(path, 'r') as content_file:
39 | content = content_file.read()
40 | # makes sure we are calling print function with a variable and not the hard coded value
41 | assert str(17172435) not in content
42 |
--------------------------------------------------------------------------------
/exercises/05-User-Inputed-Values/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=pe_DEzC-528"
3 | ---
4 |
5 | # `05` User Inputed Values
6 |
7 | Otra cosa genial de las variables es que no necesitas saber su valor para poder trabajar con ellas.
8 |
9 | Por ejemplo, justo ahora la aplicación está preguntando la edad del usuario, y luego la imprime en la consola.
10 |
11 | ## 📝 Instrucciones:
12 |
13 | 1. Por favor, añade 10 años al valor de la variable `age`.
14 |
15 | ## 💡 Pistas:
16 |
17 | + Puedes buscar en Google "Como sumarle una cantidad a una variable de Python".
18 |
19 | + Recuerda que el contenido de la variable está siendo definido con lo que sea que el usuario coloque.
20 |
--------------------------------------------------------------------------------
/exercises/05-User-Inputed-Values/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=zeWN4ujg6yU"
3 | ---
4 |
5 | # `05` User Inputed Values
6 |
7 | The other cool thing about variables is that you don't need to know their value to be able to work with them.
8 |
9 | For example, the application right now is prompting the user for its age, and then printing it on the console.
10 |
11 | ## 📝 Instructions:
12 |
13 | 1. Please add 10 years to the value of the age variable.
14 |
15 | ## 💡 Hints:
16 |
17 | + You can Google "how to add a number to a Python variable".
18 |
19 | + Remember that the content of the variable is being previously filled with whatever the user inputs.
20 |
--------------------------------------------------------------------------------
/exercises/05-User-Inputed-Values/app.py:
--------------------------------------------------------------------------------
1 | age = int(input('What is your age?\n'))
2 | # ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅
3 |
4 | print("Your age is: "+str(age))
--------------------------------------------------------------------------------
/exercises/05-User-Inputed-Values/solution.hide.py:
--------------------------------------------------------------------------------
1 | age = int(input('What is your age?\n'))
2 | # ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅
3 | age = age + 10
4 | print("Your age is: "+str(age))
5 |
--------------------------------------------------------------------------------
/exercises/05-User-Inputed-Values/test.py:
--------------------------------------------------------------------------------
1 | import pytest,os,re,io,sys,mock,json
2 | path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
3 |
4 | @pytest.mark.it('Use the function print()')
5 | def test_for_file_output(capsys):
6 | with open(path, 'r') as content_file:
7 | content = content_file.read()
8 | pattern = (r"print\s*\(")
9 | regex = re.compile(pattern)
10 | assert bool(regex.search(content)) == True
11 |
12 | @pytest.mark.it("Testing with age 50 and it is supposed to return 60")
13 | @mock.patch('builtins.input', lambda x: 50)
14 | def test_plus_ten(stdin):
15 | # f = open(os.path.dirname(os.path.abspath(__file__))+'/app.py')
16 | sys.stdout = buffer = io.StringIO()
17 | import app
18 | captured = buffer.getvalue()
19 | assert "Your age is: 60\n" in captured
20 |
21 |
--------------------------------------------------------------------------------
/exercises/06-String-Concatenation/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=4y8xYy273f4"
3 | ---
4 |
5 | # `06` String Concatenation
6 |
7 | La concatenación de strings es una tarea común en la programación que implica combinar o unir dos o más strings.
8 |
9 | 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.
10 |
11 | En Python, puedes concatenar o unir dos o más strings usando el operador `+`. Así es como funciona:
12 |
13 | ```py
14 | one = 'a'
15 | two = 'b'
16 | print(one + two) # Esto imprimirá 'ab' en la consola.
17 | ```
18 |
19 | 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.
20 |
21 | ## 📝 Instrucciones:
22 | 1. Establece los valores para `my_var1` y `my_var2` de manera que, al concatenarlos, el código imprima `Hello World` en la consola.
23 |
24 |
25 | ## 💡 Pista:
26 | + 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)
27 |
--------------------------------------------------------------------------------
/exercises/06-String-Concatenation/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=kS4qpQmHwCs"
3 | ---
4 |
5 | # `06` String Concatenation
6 |
7 | String concatenation is a common task in programming that involves combining or linking two or more strings together.
8 |
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.
10 |
11 | In Python, you can concatenate, or join together, two or more strings using the `+` operator. This is how it works:
12 |
13 | ```py
14 | one = 'a'
15 | two = 'b'
16 | print(one + two) # This will print 'ab' on the console.
17 | ```
18 |
19 | 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.
20 |
21 | ## 📝 Instructions:
22 | 1. Set the values for `my_var1` and `my_var2` so that, when concatenated, the code prints `Hello World` in the console.
23 |
24 | ## 💡 Hint:
25 | + 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)
26 |
--------------------------------------------------------------------------------
/exercises/06-String-Concatenation/app.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅
2 |
3 |
4 | ## Don't change anything below this line
5 | the_new_string = my_var1 + ' ' + my_var2
6 | print(the_new_string)
7 |
--------------------------------------------------------------------------------
/exercises/06-String-Concatenation/solution.hide.py:
--------------------------------------------------------------------------------
1 | # ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅
2 |
3 | my_var1 = "Hello"
4 | my_var2 = "World"
5 |
6 | ## Don't change anything below this line
7 | the_new_string = my_var1 + ' ' + my_var2
8 | print(the_new_string)
9 |
--------------------------------------------------------------------------------
/exercises/06-String-Concatenation/test.py:
--------------------------------------------------------------------------------
1 | import io, sys, os, re, pytest
2 | sys.stdout = buffer = io.StringIO()
3 |
4 | import app
5 |
6 | @pytest.mark.it("Create a variable named my_var1")
7 | def test_my_var1_exists():
8 | try:
9 | from app import my_var1
10 | except ImportError:
11 | raise ImportError("The variable 'my_var1' should exist on app.py")
12 |
13 | @pytest.mark.it("Create a variable named my_var2")
14 | def test_my_var2_exists():
15 | try:
16 | from app import my_var2
17 | except ImportError:
18 | raise ImportError("The variable 'my_var2' should exist on app.py")
19 |
20 | @pytest.mark.it("Variable my_var1 value should be 'Hello'")
21 | def test_my_var1_value():
22 | from app import my_var1
23 | assert my_var1.lower() == "hello"
24 |
25 | @pytest.mark.it("Variable my_var2 value should be 'World'")
26 | def test_my_var2_value():
27 | from app import my_var2
28 | assert my_var2.lower() == "world"
29 |
30 | @pytest.mark.it("Don't remove the_new_string variable")
31 | def test_the_new_string_exists():
32 | import app
33 | try:
34 | app.the_new_string
35 | except AttributeError:
36 | raise AttributeError('The variable "the_new_string" should exist on app.py')
37 |
38 | @pytest.mark.it('Print "Hello World" on the console')
39 | def test_for_file_output():
40 | captured = buffer.getvalue()
41 | assert "hello world\n" in captured.lower() #add \n because the console jumps the line on every print
42 |
--------------------------------------------------------------------------------
/exercises/07-Create-a-Basic-HTML/README.es.md:
--------------------------------------------------------------------------------
1 | ---
2 | tutorial: "https://www.youtube.com/watch?v=zbTM_T6an4k"
3 | ---
4 |
5 | # `07` Create a Basic HTML
6 |
7 | Continuemos concatenando strings para generar un documento HTML básico...
8 |
9 | ## 📝 Instrucciones:
10 |
11 | 1. Crea la variable `html_document`.
12 |
13 | 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).
14 |
15 | 3. Luego, imprime el valor de `html_document` en la consola.
16 |
17 | ## 💡 Pista:
18 |
19 | + Resultado esperado:
20 |
21 | ```html
22 |