Skip to content

Commit 6875bce

Browse files
committed
Corrección Roadmap 19 + Nuevo ejercicio 20
1 parent 1ad7b61 commit 6875bce

File tree

3 files changed

+105
-3
lines changed

3 files changed

+105
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
2828
## Corrección y próximo ejercicio
2929

30-
> #### Lunes 13 de mayo de 2024 a las 20:00 (hora España) desde **[Twitch](https://twitch.tv/mouredev)**
31-
> #### Consulta el **[horario](https://discord.gg/Z5u4TWcS?event=1234615617605075085)** por país y crea un **[recordatorio](https://discord.gg/Z5u4TWcS?event=1234615617605075085)**
30+
> #### Lunes 20 de mayo de 2024 a las 20:00 (hora España) desde **[Twitch](https://twitch.tv/mouredev)**
31+
> #### Consulta el **[horario](https://discord.gg/QhTwYW7P?event=1237107397391024128)** por país y crea un **[recordatorio](https://discord.gg/QhTwYW7P?event=1237107397391024128)**
3232
3333
## Roadmap
3434

@@ -53,7 +53,8 @@
5353
|16|[EXPRESIONES REGULARES](./Roadmap/16%20-%20EXPRESIONES%20REGULARES/ejercicio.md)|[📝](./Roadmap/16%20-%20EXPRESIONES%20REGULARES/python/mouredev.py)|[▶️](https://youtu.be/0L7IfEF19ow)|[👥](./Roadmap/16%20-%20EXPRESIONES%20REGULARES/)
5454
|17|[ITERACIONES](./Roadmap/17%20-%20ITERACIONES/ejercicio.md)|[📝](./Roadmap/17%20-%20ITERACIONES/python/mouredev.py)|[▶️](https://youtu.be/X1ROaPH_ci8)|[👥](./Roadmap/17%20-%20ITERACIONES/)
5555
|18|[CONJUNTOS](./Roadmap/18%20-%20CONJUNTOS/ejercicio.md)|[📝](./Roadmap/18%20-%20CONJUNTOS/python/mouredev.py)|[▶️](https://youtu.be/0auuM4GROVA)|[👥](./Roadmap/18%20-%20CONJUNTOS/)
56-
|19|[ENUMERACIONES](./Roadmap/19%20-%20ENUMERACIONES/ejercicio.md)|[🗓️ 13/05/24](https://discord.gg/Z5u4TWcS?event=1234615617605075085)||[👥](./Roadmap/19%20-%20ENUMERACIONES/)
56+
|19|[ENUMERACIONES](./Roadmap/19%20-%20ENUMERACIONES/ejercicio.md)|[📝](./Roadmap/19%20-%20ENUMERACIONES/python/mouredev.py)||[👥](./Roadmap/19%20-%20ENUMERACIONES/)
57+
|20|[PETICIONES HTTP](./Roadmap/20%20-%20PETICIONES%20HTTP/ejercicio.md)|[🗓️ 20/05/24](https://discord.gg/QhTwYW7P?event=1237107397391024128)||[👥](./Roadmap/20%20-%20PETICIONES%20HTTP/)
5758

5859
## Instrucciones
5960

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
from enum import Enum
2+
3+
"""
4+
Ejercicio
5+
"""
6+
7+
8+
class Weekday(Enum):
9+
MONDAY = 1
10+
TUESDAY = 2
11+
WEDNESDAY = 3
12+
THURSDAY = 4
13+
FRIDAY = 5
14+
SATURDAY = 6
15+
SUNDAY = 7
16+
17+
18+
def get_day(number: int):
19+
print(Weekday(number).name)
20+
21+
22+
get_day(1)
23+
get_day(3)
24+
25+
"""
26+
Extra
27+
"""
28+
29+
30+
class OrderStatus(Enum):
31+
PENDING = 1
32+
SHIPPED = 2
33+
DELIVERED = 3
34+
CANCELLED = 4
35+
36+
37+
class Order:
38+
39+
status = OrderStatus.PENDING
40+
41+
def __init__(self, id) -> None:
42+
self.id = id
43+
44+
def ship(self):
45+
if self.status == OrderStatus.PENDING:
46+
self.status = OrderStatus.SHIPPED
47+
self.display_status()
48+
else:
49+
print("El pedido ya ha sido enviado o cancelado")
50+
51+
def deliver(self):
52+
if self.status == OrderStatus.SHIPPED:
53+
self.status = OrderStatus.DELIVERED
54+
self.display_status()
55+
else:
56+
print("El pedido necesita ser enviado antes de entragarse.")
57+
58+
def cancel(self):
59+
if self.status != OrderStatus.DELIVERED:
60+
self.status = OrderStatus.CANCELLED
61+
self.display_status()
62+
else:
63+
print("El pedido no se puede cancelar ya que ya se ha entregado.")
64+
65+
def display_status(self):
66+
print(f"El estado del pedido {self.id} es {self.status.name}")
67+
68+
69+
order_1 = Order(1)
70+
order_1.display_status()
71+
order_1.deliver()
72+
order_1.ship()
73+
order_1.deliver()
74+
order_1.cancel()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# #20 PETICIONES HTTP
2+
> #### Dificultad: Difícil | Publicación: 13/04/24 | Corrección: 20/05/24
3+
4+
## Ejercicio
5+
6+
```
7+
/*
8+
* EJERCICIO:
9+
* Utilizando un mecanismo de peticiones HTTP de tu lenguaje, realiza
10+
* una petición a la web que tú quieras, verifica que dicha petición
11+
* fue exitosa y muestra por consola el contenido de la web.
12+
*
13+
* DIFICULTAD EXTRA (opcional):
14+
* Utilizando la PokéAPI (https://pokeapi.co), crea un programa por
15+
* terminal al que le puedas solicitar información de un Pokémon concreto
16+
* utilizando su nombre o número.
17+
* - Muestra el nombre, id, peso, altura y tipo(s) del Pokémon
18+
* - Muestra el nombre de su cadena de evoluciones
19+
* - Muestra los juegos en los que aparece
20+
* - Controla posibles errores
21+
*/
22+
```
23+
#### Tienes toda la información extendida sobre el roadmap de retos de programación en **[retosdeprogramacion.com/roadmap](https://retosdeprogramacion.com/roadmap)**.
24+
25+
Sigue las **[instrucciones](../../README.md)**, consulta las correcciones y aporta la tuya propia utilizando el lenguaje de programación que quieras.
26+
27+
> Recuerda que cada semana se publica un nuevo ejercicio y se corrige el de la semana anterior en directo desde **[Twitch](https://twitch.tv/mouredev)**. Tienes el horario en la sección "eventos" del servidor de **[Discord](https://discord.gg/mouredev)**.

0 commit comments

Comments
 (0)