Skip to content

Commit 1ef834d

Browse files
committed
weight_conversion
1 parent 947d271 commit 1ef834d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

weight_unit_conversion.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Write a program to convert the given weight unit into another unit
2+
3+
weight = float(input('Enter your weight: '))
4+
unit = input('(K)g or (L)bs: ')
5+
KG_TO_LBS_FACTOR = 2.205
6+
7+
if unit.casefold() == 'k':
8+
weight_lbs = round(weight * KG_TO_LBS_FACTOR, 2)
9+
print(f'Your Weight in lbs: {weight_lbs}')
10+
else:
11+
weight_kg = round(weight / KG_TO_LBS_FACTOR, 2)
12+
print(f'Your Weight in kg: {weight_kg}')

0 commit comments

Comments
 (0)