Salary¶
Save all functions into the same file named salary.py.
Write the function
discounting()that from a given amount and percentage (float), returns a new amount resulting from the application of this percentage discount to the given amount.See the following examples:
>>> discounting(100,20) 80.0 >>> discounting(1353,16) 1136.52 >>> discounting(183,3.5) 176.595
Note
More tests are provided in the
salary1.txtfile.A company pays its sales employees a bonus of EUR 5 per each EUR 100 of the sales amount sold by each employee. Write the function
bonus()that takes a sales amount (float), and returns the corresponding number of bonus. The number of bonus obtained by a sales employee is always an integer value.See the following examples:
>>> bonus(100) 1 >>> bonus(101) 1 >>> bonus(582) 5
Note
More tests are provided in the
salary2.txtfile.To compute the salary of its sales employees, a company applies first a discount of a certain percentage that includes taxes to the gross salary and then adds a bonus of EUR 5 per each EUR 100 of the sales amount sold by each employee.
Write the
salary()function that from a given gross salary (without discounts) of a sales employee, a discount percentage and the sales amount sold by this employee, returns the corresponding final salary. This function must call the two previous functions.See the following examples:
>>> salary(1000,12,500) 905.0 >>> salary(1000,12,0) 880.0 >>> salary(1000,11.4,1350) 951.0
Note
More tests are provided in the
salary3.txtfile.
Solutions
A solution of these functions is provided in the
salary.py file.