diff --git "a/Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/dilson1502.py" "b/Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/dilson1502.py" new file mode 100644 index 0000000000..4136f4e433 --- /dev/null +++ "b/Retos/Reto #11 - URL PARAMS [F\303\241cil]/python/dilson1502.py" @@ -0,0 +1,26 @@ +def obtener_parametros_url(url:str)->list: + """This function returns the params of a given url + + Args: + url (str): + + Returns: + list: url params + """ + + query = url.split("?") + if len(query)<=1: + return [] + parametros = query[1].split("&") + valor_parametros = [] + for parametros in parametros: + valor_parametros.append(parametros.split("=")[1]) + return valor_parametros + +# Ejemplo: En la +# * los parĂ¡metros serĂ­an ["2023", "0"] + +if __name__=="__main__": + url = "https://retosdeprogramacion.com?year=2023&challenge=0&test=true" + parametros = obtener_parametros_url(url) + print(parametros) diff --git "a/Retos/Reto #12 - VIERNES 13 [F\303\241cil]/python/dilson1502.py" "b/Retos/Reto #12 - VIERNES 13 [F\303\241cil]/python/dilson1502.py" new file mode 100644 index 0000000000..63886a5594 --- /dev/null +++ "b/Retos/Reto #12 - VIERNES 13 [F\303\241cil]/python/dilson1502.py" @@ -0,0 +1,18 @@ +from datetime import datetime + +def is_friday_13(year: int,month: int) -> bool: + """This func returns true if in a specified month in a year there is a friday 13 + + Args: + year (int): example 2023 + month (int): example 1022 + + Returns: + bool: _description_ + """ + return datetime(year,month,13).weekday() ==4 + +## sss + +if __name__ == '__main__': + print(is_friday_13(2024,10))