Skip to content

Commit

Permalink
kgs_to_lbs
Browse files Browse the repository at this point in the history
  • Loading branch information
ArwaAbdelkhalik committed Jan 11, 2025
1 parent 7281018 commit 7f99f0c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions solutions/kgs_to_lbs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
""" "
Created on 0084/01/2025
@author: Arwa Mohamed
"""


def kg_to_lbs(kg):
"""Converts a given weight from kilograms (kg) to pounds (lbs).
Parameters:
kg (float): Weight in kilograms.
Returns:
float: Equivalent weight in pounds.
>>> kg_to_lbs(75):
165.347
>>> kg_to_lbs(34):
74.957
>>> kg_to_lbs(10):
22.046
Raises:
ValueError: If the input is not a positive number.
"""
if kg < 0:
raise ValueError("Weight cannot be negative.")
return kg * 2.20462

0 comments on commit 7f99f0c

Please sign in to comment.