python weight in pound kg
In this python practice, we will ask user to input weight in pound and convert the weight in kg.


weight_pound = input("what is your weight in pound? ")
weight_kg = int(weight_pound) * 0.45
print("Your weight in KG is " + str(weight_kg))

Code Explanation

On line 1:
we ask user to input weight in pound.


weight_pound = input("what is your weight in pound? ")

On line 2:
Input function always return string type value. So, we have converted weight_pound to integer type and multiplied it by 0.45. The result is saved as weight_kg


weight_kg = int(weight_pound) * 0.45

On line 3:
We print the value of weight_kg


print("Your weight in KG is " + str(weight_kg))

Tags