Message from Python discussions
December 2018
β π
import datetime
def compare_month_day(dob: str, case_dob: str) -> bool:
parse_template = "%Y-%m-%d"
_dob = datetime.datetime.strftime(dob, parse_template)
_case_dob = datetime.datetime.strftime(case_dob, parse_template)
if _dob.day == _case_dob.month:
return True
return False
β Did I understand you correctly?
β I tried this but what is case_dob has masked year
β Case_dob could be like "****-04-27" - year masked. In this case compare month and day. If month and day are same - return True. Otherwise False.
β I am stuck here ?
β Try making 3 different if statements
β One for the year
One for the month
One for the day
β If itβs masked/true, move to the next one
β Otherwise just return false
β Okay I'll try
β Ok, if year is masker you can use split for string if structure not changes