From 7f99f0c95bba6f018181c638fc505c95c2004038 Mon Sep 17 00:00:00 2001 From: arwaabdelkhalik Date: Sat, 11 Jan 2025 23:36:02 +0300 Subject: [PATCH] kgs_to_lbs --- solutions/kgs_to_lbs.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 solutions/kgs_to_lbs.py diff --git a/solutions/kgs_to_lbs.py b/solutions/kgs_to_lbs.py new file mode 100644 index 000000000..14d5f9f38 --- /dev/null +++ b/solutions/kgs_to_lbs.py @@ -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