From 710292b8d439589876af9a917e053dd789e4131f Mon Sep 17 00:00:00 2001 From: Djokwa Date: Sat, 11 Jan 2025 22:28:02 -0800 Subject: [PATCH] convert salary docstring updates --- solutions/convert_salary.py | 8 ++++++++ solutions/tests/test_convert_salary.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/solutions/convert_salary.py b/solutions/convert_salary.py index 097fc4c3b..f95e5e05d 100644 --- a/solutions/convert_salary.py +++ b/solutions/convert_salary.py @@ -1,6 +1,12 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ +Module for converting an hourly wage to its equivalent monthly and yearly salaries. + +Module contents: + - convert_salary: A function to convert an hourly wage and +calculates the monthly and yearly salaries. + Created on 2024-01-06 @author: Henry Ogoe @@ -50,6 +56,8 @@ def convert_salary(hourly: float, hours_per_week: float = 40) -> tuple: assert hourly > 0, "Salary can not be negative." monthly_salary = hourly * hours_per_week * 4.33 + # 4.33 is approximate number of weeks in month yearly_salary = hourly * hours_per_week * 52 + # We have 52 weeks in a year return (round(monthly_salary, 2), round(yearly_salary, 2)) diff --git a/solutions/tests/test_convert_salary.py b/solutions/tests/test_convert_salary.py index e09b36fff..61982970f 100644 --- a/solutions/tests/test_convert_salary.py +++ b/solutions/tests/test_convert_salary.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -Test module for dividing two numbers function. +Test module for convert an hourly wage to its equivalent monthly and yearly salaries. Created 2025-01-04