-
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 #6555 from Dilson1502/main
Reto #11 - Python
- Loading branch information
Showing
2 changed files
with
44 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,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) |
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,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)) |