Explore Python Programs # Python Payroll Calculator With Loop Want to know how to create python payroll calculator with loop, then you are at the right place today in this tutorial. I will show you how to create a python payroll calculator with loop, so follow this tutorial till the end.

So in this python payroll program first we will asks the user to enter hours worked, hour rate, pf and tax then it will calculate the basic salary and deduct pf and tax and finally it will print the total salary so now let’s see how to do this in program.

## Python Payroll Calculator Program With Loop

``````
is_stop = False

while is_stop == False:

hours_worked = int(input("How many hours worked: "))
hour_rate = int(input("Rate per hour: "))

pf = int(input("PF Amount: "))
tax = int(input("Tax Payable: "))

basic_salary = hours_worked * hour_rate
total_salary = basic_salary - (pf + tax)

print(f"After deductions your total salary is \${total_salary}")

q = input("Do you want to calculate another payroll enter y or n: ")

if(q == 'n'):
is_stop = True
```
```

Above is the python payroll program or payroll calculator. Now to run this program you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer.

The Complete Python Programming Boo...
The Complete Python Programming Bootcamp

To run this python program, follow the below steps:

• Create a new folder for this python project.
• Open it in a code editor of your choice.
• Create a python file with an ending .py extension.
• Copy the above code and paste it in your file.
• Open a terminal or CMD at folder location
• And type this command python filename.py (Name of your file).

After running this program you will asked to enter the hours worked, hour rate, pf and tax then it will print the total salary, Below is an example output. I have created this python payroll calculator using loop so it will run till enter n when it asks you do you want to continue.

``````
How many hours worked: 40
Rate per hour: 22
PF Amount: 2
Tax Payable: 2
After deductions your total salary is \$876
Do you want to calculate another payroll enter y or n: y
How many hours worked: 43
Rate per hour: 23
PF Amount: 23
Tax Payable: 23
After deductions your total salary is \$943
Do you want to calculate another payroll enter y or n: n
```
```

Don’t want to create all the files and folders then you can run this program now using this online python compiler it is fast and easy.

## Summary

This was the python payroll calculator program using loops. I hope you found this tutorial helpful and useful. Do share this tutorial with your friends who might be interested in this program.

Here are some more python drawing tutorials for you:

I hope you found what you were looking for from this tutorial, and if you want more python programs and tutorials like this, do join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂