dennoh

4. Calc Total Salary

Jan 21st, 2021
829
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def calculateTotalSalary(month_sal, no_of_years):
  2.     MONTHS_IN_A_YEAR = 12
  3.     BONUS = 1.05
  4.     if no_of_years > 5:
  5.         total_salary = month_sal * 5 * MONTHS_IN_A_YEAR
  6.         extra_years = no_of_years - 5
  7.         total_salary +=  month_sal  * extra_years * MONTHS_IN_A_YEAR * BONUS
  8.     else:
  9.         total_salary = month_sal * no_of_years * MONTHS_IN_A_YEAR
  10.  
  11.     return total_salary
  12.  
  13.    
  14. if __name__ == "__main__":
  15.     print(calculateTotalSalary(20, 6))
  16.    
RAW Paste Data