بخشی از مجموعه

Several example codes

~1 دقیقه مطالعه • بروزرسانی ۲۵ شهریور ۱۴۰۴

Program Overview

This Python program reads the base salary of an employee and calculates deductions for insurance and tax.
It then computes the net income after these deductions.

Python Code:


salary = float(input("Please enter the base salary (in Toman): "))

insurance_rate = 0.07   # 7% insurance
tax_rate = 0.10         # 10% tax

insurance = salary * insurance_rate
tax = salary * tax_rate
net_income = salary - insurance - tax

print("Insurance amount:", insurance)
print("Tax amount:", tax)
print("Net income:", net_income)

Sample Output:


Please enter the base salary (in Toman): 10000000
Insurance amount: 700000.0
Tax amount: 1000000.0
Net income: 8300000.0

Explanation:

Here’s how the program works:
- It assumes an insurance rate of 7% and a tax rate of 10%
- The insurance and tax amounts are calculated by multiplying the base salary by their respective rates
- The net income is calculated by subtracting both deductions from the base salary
- The results are displayed using the print() function


نوشته و پژوهش شده توسط دکتر شاهین صیامی