Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do this in Python. Total Salary: Bug Explanation, if any INSTRUCTIONS: DO NOT CORRECT THE GIVEN CODE OR DO ANY MODIFICATIONS, JUST EXPLAIN WHAT

Please do this in Python.

Total Salary: Bug Explanation, if any

INSTRUCTIONS: DO NOT CORRECT THE GIVEN CODE OR DO ANY MODIFICATIONS, JUST EXPLAIN WHAT IS WRONG WITH THE GIVEN CODE. THAT'S ALL.

Problem Statement: Write a program to calculate the total salary of a person. The user has to enter the basic salary (an integer) and the grade (an uppercase character), and depending upon which the total salary is calculated as-

totalSalary = basic + hra + da + allow pf

where :

hra = 20% of basic da = 50% of basic allow = 1700 if grade = A allow = 1500 if grade = B allow = 1300 if grade = C' or any other character pf = 11% of basic.

Round off the total salary and then print the integral part only.

Note: Try finding out a function on the internet to do so.

Input format : Basic salary & Grade (separated by space)

Output Format : Total Salary

Sample Input 1 : 10000 A

Sample Output 1 : 17600

Sample Input 2 : 4567 B

Sample Output 2 : 8762

CODE:

l = input().strip().split(' ')

basic = int(l[0]) grade = l[1]

hra = 20 // 100 * basic da = 50 // 100 * basic

if (grade=="A"): allow = 1700 elif (grade=="B"): allow = 1500 else: allow = 1300 pf = 0.11 * basic salary = basic + hra + da + allowance - pf

print(int(salary))

This is how the code looks in editor:

image text in transcribed

Here the idea is, you have been given the code of a student who has a doubt during his/her submission and wants your help to guide him/her to the solution. Remember, he/she is not looking for the solution, instead, wants to know where he/she is wrong and why doesn't it work the way he/she thinks it should! So help the student understand why doesn't it work and what other aspects do he/she need to emphasize on!

Python Code 2 1 input().strip().split(' ') 3 4 basic=int(1[0]) 5 grade=l[1] 6 7 hra = 20 // 100 * basic 8 da = 50 // 100 * basic 9 10 if(grade=='A'): 11 allow = 1700 12 elif(grade 'B'): 13 allow = 1500 14 else: 15 allow = 1300 16 17 18 pf = 0.11 * basic 19 salary= basic + hra + da + allowance - pf 20 21 print(int (salary))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago