Reference no: EM132360746
Question
Define a function named future_date that first takes a string as an argument (representing a possible date: see 2a for the specification of legal dates); its second argument is the number of days to "advance" the date into the future (5 means 5 days into the future), and its third argument is the current year (e.g., 2016). This function returns a string representing the future date.
For example, calling the function future_date('3/27/16',10,2016) returns the date 10 days in the future; it returns the value '4/6/16'; calling future_date('3/27',10,2016) returns '4/6': if no year is specified, use the 3rd argument as the year, but don't include the year in the returned value (even if it changes). The year, if present, must always appear in the returned result as two digits : years 2000 or 2005, would appear as '.../00' and .../05'.
Raise an AssertionError exception (using Python's assert statement) if the first argument is an illegal date: by the specification in 2a, or if the actual day specified is not legal in the month specified (e.g., 2/30 in any year). Also raise this exception if the second argument is negative (0 means no advancement).