Skip to content

Commit

Permalink
Merge pull request #6555 from Dilson1502/main
Browse files Browse the repository at this point in the history
Reto #11 - Python
  • Loading branch information
kontroldev authored Jun 4, 2024
2 parents ac6c204 + 39c19c1 commit d2229e6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Retos/Reto #11 - URL PARAMS [Fácil]/python/dilson1502.py
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions Retos/Reto #12 - VIERNES 13 [Fácil]/python/dilson1502.py
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit d2229e6

Please sign in to comment.