hello,
what is wrong with this date:
29/02/2019
why the need for error?
thanks!
This function should take a date string in the format dd/mm/yyyy and convert it to the format yyyy-mm-dd. If the input is not in the correct format, the function should return an error message "Error: Invalid date.".
assert convertdate("25/12/2021") == "2021-12-25"
assert convertdate("01/01/2000") == "2000-01-01"
assert convertdate("15/06/1995") == "1995-06-15"
assert convertdate("29/02/2020") == "2020-02-29"
assert convertdate("10/10/2010") == "2010-10-10"
assert convertdate("31/05/1985") == "1985-05-31"
assert convertdate("07/08/1960") == "1960-08-07"
assert convertdate("02/09/1999") == "1999-09-02"
assert convertdate("30/04/1975") == "1975-04-30"
assert convertdate("29/02/2019") == "Error: Invalid date."
assert convert_date("30/04/1975/1") == "Error: Invalid date."
print("The mission is done! Click 'Check Solution' to earn rewards!")
Created at: 2024/01/18 21:31; Updated at: 2024/01/19 11:40