Загрузить файлы в «/»
This commit is contained in:
parent
2385c379df
commit
448e1da24f
10
comparsion.py
Normal file
10
comparsion.py
Normal file
@ -0,0 +1,10 @@
|
||||
def compare(a: str) -> bool:
|
||||
for i in range(len(a)):
|
||||
if(a[i].isdigit() == False):
|
||||
if a[i] == "<":
|
||||
return int(a[:i]) < int(a[i + 1:])
|
||||
else:
|
||||
return int(a[:i]) > int(a[i + 1:])
|
||||
|
||||
print(compare("2>5"))
|
||||
|
||||
14
last_friday_datetime.py
Normal file
14
last_friday_datetime.py
Normal file
@ -0,0 +1,14 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def get_last_friday(a: str) -> str:
|
||||
date = datetime.strptime(a, "%m/%Y").date()
|
||||
next_month = date.replace(day=28) + timedelta(days=7)
|
||||
last_day = next_month - timedelta(days=next_month.day)
|
||||
|
||||
# Идем назад до пятницы
|
||||
while last_day.weekday() != 4:
|
||||
last_day -= timedelta(days=1)
|
||||
|
||||
return last_day.strftime("%d.%m.%Y")
|
||||
|
||||
print(get_last_friday("05/2022"))
|
||||
Loading…
Reference in New Issue
Block a user