so here's my code for the "date is before" helper procedure. if year 1 is before year 2 then we can return true right away. we don't care about the months and the days if the years are different. if the years are equal then we need to look at the months. if month 1 is before month 2, we return true. if the month's were the same, then we look at the days. and note that we don't have elses here. but
How To Add Fractions In Python, if we don't hit the returns we're going to fall through to this last statement and return false. and that could happen if either year 1 is greater than year 2, or the years are equal and month 1 is greater than month 2, or the months are equal and day 1 is greater than day 2. in all of those cases, the first date is
not in before the second date and we should return false.
No comments:
Post a Comment