728x90
1. Problem: https://py.checkio.org/en/mission/latest-iso-datetime/
2. My solution
import datetime
def get_latest(dt1str: str, dt2str: str) -> str:
time_comparison = []
# your code here
for date in [dt1str, dt2str]:
dummy_data = date.split('-')
dummy_data[0] = str(int(date.split('-')[0])+3000)
convert_to_unix_time = datetime.datetime.strptime("-".join(dummy_data), "%Y-%m-%dT%H:%M:%S").timestamp()
time_comparison.append(convert_to_unix_time)
if time_comparison[0] > time_comparison[1]: return dt1str
else: return dt2str
728x90
'프로그래밍 문제 > [Python] CheckIO' 카테고리의 다른 글
[CheckIO/Scientific Expedition] Beat The Previous (0) | 2024.03.24 |
---|---|
[CheckIO/Scientific Expedition] Pangram (0) | 2024.03.24 |
[CheckIO/Scientific Expedition] Longest substring of unique characters (0) | 2024.02.18 |
[CheckIO] Replace All Occureences (0) | 2024.02.18 |
[CheckIO] Convert To Title case (0) | 2024.02.18 |
댓글