Leaver Holiday Calculator
Calculate a leaving employee's holiday balance.
Leaving employees are entitled to payment for accrued but unused holidays. Employers can deduct from an employee's final pay if they have overused their holiday when calculated pro-rata at the leaving date.
- Write the script
- Use the script from the terminal
1. Write the script
This step is as simple as pasting the code below into a new python file.
Make a new file called leaver_calc.py. In the terminal you can simply enter:
$ touch leaver_calc.py
Now open it in your favourite text editor and enter the following:
2. Use the script from the terminal
Open your terminal, and go to the directory you saved leaver_calc.py in. Use the
cd command to change directories.
Check the script is indeed in your current director by ensuring the filename is lister there when you run the list command:
$ ls -l
Now run the script by entering the following:
$ python3 leaver_calc.py
If you entered the script correctly, you should see it prompt you for the relevant information such as start date (i.e. the start of the holiday year), leaving date et cetera. Once the information has been given, the pro-ated balance of days will be calculated.
You could easily extend the functionality of the script - why not try adding a "salary" input to work out the size of the payment based on the resulting number of days?