def pad(s):
return s if len(s) == 2 else "0" + s
def date_munch_mmddyyyy(s):
guts = s.split("/")
return f"{guts[2]}-{pad(guts[0])}-{pad(guts[1])}"
def date_munch_ddmmyyyy(s):
guts = s.split("/")
return f"{guts[2]}-{pad(guts[1])}-{pad(guts[0])}"
print(date_munch_mmddyyyy("10/9/1972"))
print(date_munch_ddmmyyyy("9/10/1972"))