In the lecture, you have been given the design of a Python function that computes net...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 <7 else 100608.90 return gross if gross <limit else limit 45 46 def get_tax_data (cumulative_base): 47 r = None 48 49 50 51 52 53 54 55 56 57 58 59 Tprev None Cmin = None if cumulative_base >= 0 and cumulative_base <70000.00: r, Tprev, Cmin = 0.15, 0.00, 0.00 elif 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.00: r, Tprev, Cmin = 0.27, 26500.00, 150000.00 elif cumulative_base >= 550000.0 and cumulative_base <1900000.00: r, Tprev, Cmin = 0.35, 134500.00, 550000.00 elif 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. 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 <7 else 100608.90 return gross if gross <limit else limit 45 46 def get_tax_data (cumulative_base): 47 r = None 48 49 50 51 52 53 54 55 56 57 58 59 Tprev None Cmin = None if cumulative_base >= 0 and cumulative_base <70000.00: r, Tprev, Cmin = 0.15, 0.00, 0.00 elif 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.00: r, Tprev, Cmin = 0.27, 26500.00, 150000.00 elif cumulative_base >= 550000.0 and cumulative_base <1900000.00: r, Tprev, Cmin = 0.35, 134500.00, 550000.00 elif 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.
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Delia Alvarez, owner of Delia's Lawn Service, wants to borrow money to buy new lawn equipment. A local bank has asked for financial statements. Alvarez has asked you to prepare financial statements...
-
What type of isomers are exhibited by [Fe(en) 3 ]Cl 2 (en = ethane-1,2-diamine)? no isomers are possible. cis and trans isomers fac and mer isomers optical isomers
-
TMC issued $50 million of its 12% bonds on April 1, 2011, at 98 plus accrued interest. The bonds are dated January 1, 2011, and mature on December 31, 2030. Interest is payable semiannually on June...
-
Describe green washing. How does it relate to effective communication?
-
DOUG: Now that it looks like we are going to get approval on these two new cancer drugs, we need to get a sales force out there selling them for us and we need to do it quickly. HAROLD: I agree. Weve...
-
The SEC Form 10-K of Google is reproduced online at www.wiley.com/college/pratt. REQUIRED: Review the Google 10K, and answer the following questions: a. What percentage of Googles total assets were...
-
Back Country Airlines has the following accounts and balances as of their year-end, December 31st, 20X1 (assume all balances are "normal"). In good form (including proper headings subtotals, labels,...
-
Preparing Closing Journal Entries The following selected accounts appear in The GAP Inc.'s financial statements for the fiscal year ended February 2, 2019. $ millions Debit Sales Credit $16,580 Cost...
-
What financial goal is expressed on the last row of the budget and the income statement? Explain in details.
-
To help fund an addition to your house, you borrow \(\$ 5,000\) from your bank. The conditions of your loan state that the interest rate is 10 percent compounded monthly. Assuming a tax rate of 40...
-
Which of the following is true about the minimum attractive rate of return (MARR) used in judging the economic value of projects? a. MARR has no bearing on engineering projects. b. MARR is the same...
-
Three alternatives are being considered to attract new clients to a health club. A jogging track has an expected useful life of 8 years; a stationary bike 4 years, and a treadmill 6 years. What is...
-
The city planning commission would like to create a fund to provide maintenance on a newly constructed bridge over Rain Swollen Creek. The commission estimates that it will cost \(\$ 2,000 /\) year...
-
Harolds U-Store-It is using a loan to finance the construction of a new storage facility. The loan is for $1,000,000 to be repaid over 20 years with annual payments. The mortgage interest rate is 5...
-
Using the internet to locate information can be a useful tool to the student (or manager) interested in exploring topics in OB. For this first exercise, go to www.searchenginewatch.com to learn more...
-
Avatar Financials, Inc., located on Madison Avenue, New York City, is a company that provides financial advice to individuals and small- to mid-sized businesses. Its primary operations are in wealth...
-
Explain how the four objectives of public sector financial reporting support public accountability. Illustrate your points with examples.
-
Identify differences apparent to readers of a financial statement prepared based on the PSA reporting framework compared with a financial statement prepared for a publicly accountable profit-oriented...
-
Straw Hat Enterprises is a private company located in Toronto, Ontario created 12 years ago to import and distribute products from all over the world to be sold to dollar stores in Canada and...
-
For coordinates \(\left(x^{1}, x^{2} ight)\) and metric \(g=\operatorname{diag}\left(g_{11}, g_{22} ight)\), the Gaussian curvature is For a sphere with coordinates defined in the following figure,...
-
Consider the holonomic basis defined in Box 26.1 . Using that the tangent vector for a curve can be written \(t=t^{\mu} e_{\mu}=\left(d x^{\mu} / d \lambda ight) e_{\mu}\), show that Thus, \(g_{\mu...
-
The Lie bracket of vector fields \(A\) and \(B\) is defined as their commutator, \([A, B]=\) \(A B-B A\). The Lie bracket of two basis vectors vanishes for a coordinate basis but not for a...
Study smarter with the SolutionInn App