fork download
  1. f=lambda x:[min(x[0][::-1],['31','30'][x[1]=='11']),min(x[1][::-1],'12'),x[2][::-1]]
  2.  
  3. for i in [['21','07','2016'],
  4. ['12','11','1991'],
  5. ['01','01','2000'],
  6. ['27','08','1875'],
  7. ['18','12','2010'],
  8. ['13','01','1981'],
  9. ['04','11','1671'],
  10. ['28','11','2036'],
  11. ['14','06','1855'],
  12. ['30','10','9999'],
  13. ['01','01','2851']]:
  14. print('%s -> %s'%(i,f(i)))
Success #stdin #stdout 0.03s 9984KB
stdin
Standard input is empty
stdout
['21', '07', '2016'] -> ['12', '12', '6102']
['12', '11', '1991'] -> ['21', '11', '1991']
['01', '01', '2000'] -> ['10', '10', '0002']
['27', '08', '1875'] -> ['31', '12', '5781']
['18', '12', '2010'] -> ['31', '12', '0102']
['13', '01', '1981'] -> ['31', '10', '1891']
['04', '11', '1671'] -> ['30', '11', '1761']
['28', '11', '2036'] -> ['30', '11', '6302']
['14', '06', '1855'] -> ['31', '12', '5581']
['30', '10', '9999'] -> ['03', '01', '9999']
['01', '01', '2851'] -> ['10', '10', '1582']