Skip to content

Commit

Permalink
convert salary docstring updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Djokwa committed Jan 12, 2025
1 parent a881963 commit 710292b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions solutions/convert_salary.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion solutions/tests/test_convert_salary.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 710292b

Please sign in to comment.