-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5813 from treber/treber
Reto #11 - Python
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Reto #11: URL params | ||
#### Dificultad: Fácil | Publicación: 13/03/23 | Corrección: 20/03/23 | ||
|
||
## Enunciado | ||
|
||
""" | ||
/* | ||
* Dada una URL con parámetros, crea una función que obtenga sus valores. | ||
* No se pueden usar operaciones del lenguaje que realicen esta tarea directamente. | ||
* | ||
* Ejemplo: En la url https://retosdeprogramacion.com?year=2023&challenge=0 | ||
* los parámetros serían ["2023", "0"] | ||
*/ | ||
""" | ||
|
||
url = input("Pegue su url con parámetros: ") | ||
|
||
|
||
def findParams(): | ||
params = [] | ||
x = url.split("?") | ||
lista = x[1].split("&") # ['year=2023', 'challenge=0'] | ||
for y in lista: | ||
z = y.split("=") # ['year', '2023'] | ||
params.append(z[1]) | ||
|
||
return params | ||
|
||
params_url = findParams() | ||
print(f"los parámetros de la url son: {params_url}") |