Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the lecture, you have been given the design of a Python function that computes net monthly income when monthly gross income is known

1 keys = [ 2 46 def get_tax_data (cumulative_base): 47 r = None 49 52 53 563 57 58 59 60 61 62 63 64 66 Tprev= None. Cmin67 68 def gross_to_net (p): 69 check_keys (p, keys) cumulative = 0 income tax = 0 for i in range (12):


 
 

In the lecture, you have been given the design of a Python function that computes net monthly income when monthly gross income is known for year 2023 in Turkiye. You are required to design a Python function that computes gross monthly income when net monthly income is known for the same year and regulations. 1 keys = [ 2 3 4 5 "Gross Income "Insurance", "Unemployment", "Stamp Tax", "Cumulative Tax Base", "Cumulative Income Tax", "Monthly Income Tax", "Exclusion for Income Tax", 7 "Tax Ratio", 8 9 10. 11 12 13 14 15 16] 17 "Exclusion for Stamp Tax", "Net Income" "Employer's Share for Insurance", "Employer's Share for Unemployment", "Total Cost for Employee" 18 factor = f 19 20 21 22 23 24} 25 "insurance": 0.14, "unemployment": 0.01, "stamp_tax": 0.00759, "insurance_employer": 0.155, "unemployment employer": 0.02 26 def check_keys (p, keys, skip=""): 111 Checks the keys in the dict p. If present ensures its value to be a list of size 12, If not, creates the key and assigns a list of size 12, with 0 values for key in keys: 27 28 20 30 31 32 34 if key skip: 35 30 37 p[key] = continue if key not in p: [0 for i in range (12)] 38 else: 39 if not (type (p[key] == 40 = list) and len (p[key]) == 12): p[key] =[0 for i in range (12)] 41 42 def insurance_base (gross, imonth = 1) : 43 44 limit 75060.00 if imonth = 0 and cumulative_base = 70000.0 and cumulative_base < 150000.00: r, Tprev, Cmin = 0.20, 10500.00, 70000.00 elif cumulative_base >= 150000.0 and cumulative_base = 550000.0 and cumulative_base = 1900000.0: r, Tprev, Cmin = 0.40, 607000.00, 1900000.00 60 61 return { 62 63 641 65 66 67 } "ratio": r, "Tprev": Tprev, "Cmin": Cmin 68 def gross _to_net (p): 69 70 71 72 73 check_keys (p, keys) cumulative = 0 income tax = 0 for i in range (12): imonth i + 1 1 69 70 71 68 def gross_to_net (p): check_keys (p, keys) cumulative = 0 income tax = 0 72 for i in range (12): 73 imonth i + 1 74 75 76 77 78 79 80 81 82 base_for_insurance = insurance_base (p["Gross Income"] [i], imonth) p["Insurance"] [i] = factor ["insurance"] base_for_insurance p["Unemployment"] [i] = factor ["unemployment"] base_for_insurance cumulative = cumulative + p["Gross Income"][i]p["Insurance"] [i]p["Unemployment" ][i] p["Cumulative Tax Base"] [i] = cumulative p["Stamp Tax"] [i] = factor ["stamp_tax"] * p["Gross Income"][i]. p["Exclusion for Income Tax"] [i] = 1276.02 if imonth < 7 else 2280.47 75.96 if imonth < 7 else 101.82 p["Exclusion for Stamp Tax"] [i] p["Employer's Share for Insurance"] [i] = base for insurance factor ["insurance_employer"] * 83 p["Employer's Share for Unemployment"] [i] base for insurance = factor ["unemployment employer"] * 84 tax_data = get_tax_data (cumulative) 85 p["Tax Ratio"] [i] = tax_data["ratio"] 86 tax_data["Cmin"]) + p["Cumulative Income Tax"] [i] = tax_data["ratio"] (cumulative tax_data["Tprev"] - p["Monthly Income Tax"] [i] = p["Cumulative Income Tax"] [i]- income_tax income tax = p["Cumulative Income Tax"] [i] p["Net Income"] [i] = p["Gross Income"] [i]\ - p["Insurance"] [i]\ - p["Unemployment"] [i] \ - p["Stamp Tax"] [i] \ - p["Monthly Income Tax"] [i]\ 87 88 89 90 91 92 93 94 95 96 97 p["Total Cost for Employee"] [i] = p["Gross Income"] [i]\ 98 99 + p["Exclusion for Income Tax"] [i]\ + p["Exclusion for Stamp Tax"] [i] +p["Employer's Share for Insurance"] [i] \ + p["Employer's Share for Unemployment"] [i] You can check your results using the web application at [1]. Please note that computations depend on some upper and lower limits. For simplicity we can disregard lower limits and use sufficiently large amounts (> 20000,00 TL). However, upper limits must be considered. That is, insurance and unemployment cuts are limited to 75060,00 TL gross income for the first six months of 2023, and to 100608,90 TL for the last six months of 2023. All field included in the lecture solution must also be present in the data structure returned by the function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To design a Python function that computes the gross monthly income when the net monthly income is known for the year 2023 in Turkiye based on the give... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Accounting

Authors: Gail Fayerman

1st Canadian Edition

9781118774113, 1118774116, 111803791X, 978-1118037911

More Books

Students also viewed these Programming questions

Question

Briefly describe computer-aided approaches to production.

Answered: 1 week ago

Question

How can a layout help or hinder productivity?

Answered: 1 week ago