Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for The First Working Day by Elena_Korljukova
import datetime
def vacation(date, days):
date1 = [int(i) for i in date.split('-')]
date2 = datetime.date(*date1) + datetime.timedelta(days)
w = date2.isoweekday()
date2 = date2 + datetime.timedelta(2) if w == 6 else date2 + datetime.timedelta(1) if w == 7 else date2
return str(date2)
if __name__ == '__main__':
print("Example:")
print(vacation('2018-07-01', 14))
#These "asserts" using only for self-checking and not necessary for auto-testing
assert vacation('2018-07-01', 14) == '2018-07-16'
assert vacation('2018-02-19', 10) == '2018-03-01'
assert vacation('2000-02-28', 5) == '2000-03-06'
assert vacation('1999-12-20', 14) == '2000-01-03'
print("Coding complete? Click 'Check' to earn cool rewards!")
Oct. 25, 2020