Python Program - Convert Pounds to Kilograms
Python Program - Convert Pounds to Kilograms
To convert Pounds to Kilograms in Python, you can use the following formula in the program.
Kilograms = Pounds * 0.45359237
Let us write a function, that takes the Pounds value as argument, computes the Kilograms using the above formula, and returns the result.
def poundsToKilograms(pounds):
return pounds * 0.45359237
You may use this function, in your program, to convert Pounds to Kilograms.
The following is an example program, where we shall use the above conversion function, and convert 10
Pounds to Kilograms and print the result to output.
Python Program
# Function that converts Pounds to Kilograms
def poundsToKilograms(pounds):
return pounds * 0.45359237
if __name__ == "__main__":
# Given pounds
pounds = 10
# Convert Pounds to Kilograms
kilograms = poundsToKilograms(pounds)
print(f"{pounds} Pounds is equal to {kilograms} Kilograms")
Output
10 Pounds is equal to 4.535923700000001 Kilograms
To implement the formula, we used Python Multiplication from Arithmetic Operators.
To verify your output, you can use this online tool: Convert Pounds to Kilograms online by ConvertOnline.org.