From 598f650f10cfd3501d32f3a7e2a35b4d372e8f35 Mon Sep 17 00:00:00 2001 From: ShinMugenNoKabe Date: Sat, 29 Jul 2023 23:02:28 +0200 Subject: [PATCH] Reto #11 - Python --- .../python/ShinMugenNoKabe.py" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/ShinMugenNoKabe.py" diff --git "a/Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/ShinMugenNoKabe.py" "b/Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/ShinMugenNoKabe.py" new file mode 100644 index 0000000000..76193c6ba1 --- /dev/null +++ "b/Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/ShinMugenNoKabe.py" @@ -0,0 +1,14 @@ +def get_paramteres(url: str) -> list[str]: + if not "?" in url: + return [] + + query = url.split("?")[1] + params = query.split("&") + + return [param.split("=")[1] for param in params] + + +if __name__ == "__main__": + result = get_paramteres("https://retosdeprogramacion.com?year=2023&challenge=0") + assert result == ["2023", "0"] + print(result) \ No newline at end of file