← Back to challenges

Palindromic Dates

PythonHarddatesstringsvalidation

Instructions

The 2nd of February 2020 is a palindromic date in both dd/mm/yyyy and mm/dd/yyyy format (02/02/2020). Given a date in dd/mm/yyyy format, return True if the date is palindromic in both date formats, otherwise return False.

Examples

palindromic_date("02/02/2020") ➞ True

palindromic_date("11/12/2019") ➞ False

palindromic_date("11/02/2011") ➞ False
# Although 11/02/2011 is palindromic in dd/mm/yyyy format,
# it isn't in mm/dd/yyyy format (02/11/2011)

Notes

  • All dates will be valid in both date formats.
  • The date must be palindromic in both dd/mm/yyyy and mm/dd/yyyy formats to pass.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Balanced List