Login and get coding
We've all been affected by COVID-19 in one way or another. One way that I've been affected is with my vacation time or PTO ("paid time off"). In the job that I do, I can't simply take time off. A replacement has to be flown in so the company has "Vacation Coverage" guys.
We were recently told that due to the pandemic all non-essential travel is prohibited, so no vacation coverage! On top of that, company policy to "use or lose" vacation was still in effect. So we have to figure out how to use our vacation time before the year ends or we lose it!
I dabble in Python a bit, so I figured that I could leverage those skills into creating a list of dates that I can take off and what better days to take off than Friday and Monday, therefore maximizing the time off at my disposal! At the same time, I wanted to be able to generate a list of my actual work days left for the remainder of the year.
Sounds simple, but there are some things to consider like federal holidays. If a holiday falls on either of those days, then I don't consider that a valid staycation weekend. The company frowns on taking extra days off on holiday weekends. Also, I'm working from home a couple of days per week so those must not be counted as work days either.
I know, it's unrealistic that I only work one day per week, but just play along for now.
Four Day Weekend Report
This report should include the following:
- number of four-day weekends left until the end of the year
- display your current PTO hours (days)
- your PTO balance if you were to take every Friday and Monday off until the end of the year
- list the dates of valid four day weekends, i.e. [Friday, Monday]
- indicate which weekend marks the point were you will start losing vacation days if you don't start taking days off with an asterisk
Example of what it should look like18 Four-Day Weekends
PTO: 200 (25 days)
BALANCE: -88 (11 days)
2020-08-07 - 2020-08-10
2020-09-18 - 2020-09-21 *
2020-12-18 - 2020-12-21
Work Day Report
For this portion of the code, you will generate a report like the last one, but this time with the following:
- remaining work hours/days
- list of dates
Example of what it should look likeRemaining Work Days: 184 (23 days)
Your task for this challenge will be to complete the
four_day_weekends()function. The function will take three named arguments,
show_workdays, each having default values.
If the function is called without specifying which variable it belongs to, a
ValueErrorshould be raised with the provided
I usually tend to guide you towards a certain solution. In this Bite, I'm leaving it up to you how you accomplish it. As long as you get the same results, it will do. Have fun!
23 out of 27 users completed this Bite.
Will you be Pythonista #24 to crack this Bite?
Resolution time: ~105 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 8.0 on a 1-10 difficulty scale.
» Up for a challenge? 💪