English

Write a program to input employee no, name, basic pay and find HRA, DA and netpay. Basic pay Hra Da >100000 15% 8% <=100000and>50000 10% 5% <=50000 5% 3%

Advertisements
Advertisements

Question

Write a program to input employee no, name, basic pay and find HRA, DA and netpay.

Basic pay Hra Da
>100000 15% 8%
<=100000&>50000 10% 5%
<=50000 5% 3%
Code Writing
Advertisements

Solution

Select HRA and DA according to basic pay, then calculate netpay.

employee_no = input("Enter employee no: ")
name = input("Enter name: ")
basic_pay = float(input("Enter basic pay: "))

if basic_pay > 100000:
    hra = basic_pay * 15 / 100
    da = basic_pay * 8 / 100
elif basic_pay > 50000:
    hra = basic_pay * 10 / 100
    da = basic_pay * 5 / 100
else:
    hra = basic_pay * 5 / 100
    da = basic_pay * 3 / 100

netpay = basic_pay + hra + da

print("Employee no:", employee_no)
print("Name:", name)
print("HRA:", hra)
print("DA:", da)
print("Netpay:", netpay)
shaalaa.com
  Is there an error in this question or solution?
Chapter 1: Review of Phython - EXERCISE [Page 26]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 1 Review of Phython
EXERCISE | Q 12. | Page 26
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×