Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Latest ISO datetime by dig
def change_format(dt1str):
dt1str=dt1str.replace("T","-").replace(":","-")
return dt1str.split("-")
def get_latest(dt1str: str, dt2str: str) -> str:
list1=change_format(dt1str)
list2=change_format(dt2str)
for element1, element2 in zip(list1,list2):
if int(element1)int(element2):
return dt1str
else:
pass
return dt1str # 2 cases are equal
print("Example:")
print(get_latest("2027-09-01T01:03:10", "1997-04-15T11:18:14"))
assert get_latest("2007-03-04T21:08:12", "2007-03-04T21:08:12") == "2007-03-04T21:08:12"
assert get_latest("2027-09-01T01:03:10", "1997-04-15T11:18:14") == "2027-09-01T01:03:10"
assert get_latest("0001-01-01T01:01:01", "3000-11-16T13:27:02") == "3000-11-16T13:27:02"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Jan. 23, 2023
Comments: