Tuesday, 6 November 2012

Calculate House Rent And Convince Allowance


# This code is to calculate house rent and convince allowance bonus and adding to your salary

salary=input('Enter Salary: ')
#Here i have assign values to house_rent and convince allownce to make them local not global variables. if i not give them values then in else condition this will give some errors and will become odd type of program.
house_rent=0
convince_allownce=0
if salary >=20000:
    house_rent=salary/100*50
    convince_allownce=salary/100*20
elif salary >=10000:
    house_rent=salary/100*30
    convince_allownce=salary/100*15
elif salary >=7000:
    house_rent=salary/100*10
    convince_allownce=salary/100*5
else:
    print 'You Are Unable to get Bonus....!!!'
   
print 'Your House Rent Bonus is: ', house_rent
print 'Your Convince Allownce Bonus is: ', convince_allownce
nsalary=salary+house_rent+convince_allownce
print 'Your Salary is: ', nsalary

No comments:

Post a Comment