CTC to Take-Home Breakdown

Medium ⏱ 12 min 58% acceptance ★★★★★ 4.7
Write salary_slip(ctc) for a simplified Indian structure: basic = 40% of CTC, HRA = 50% of basic, PF deduction = 12% of basic, professional tax = 2400 flat/year; special allowance fills whatever remains of CTC. Return a dict of all five components (annual, 2-decimal rounded) plus take_home = ctc − pf − prof_tax.

Examples

Example 1
Input
salary_slip(1000000)
Output
{'basic': 400000.0, 'hra': 200000.0, 'special': 400000.0, 'pf': 48000.0, 'prof_tax': 2400, 'take_home': 949600.0}
Explanation

Components derived in the stated order.

Constraints

  • special = ctc − basic − hra.
  • Round money to 2 decimals.

Topics

Business Logicpayroll

Companies

DarwinboxGreytHRZoho

Hints

Hint 1

Derive basic first — everything hangs off it.

Hint 2

Deductions subtract from CTC, not from basic.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.