Program to convert Pounds to Kilograms in Python
In this python programming guide, we are going to learn,
-
program to convert pounds to kilograms in python
Program to convert Pounds to Kilograms in Python
The python code converting pounds to kilograms is as follows:
# Owner : TutorialsInhand Author : Devjeet Roy
pounds = int(input("Enter weight in Pounds: "))
kgs = pounds/2.2046
print("The weight in kgs is",round(kgs,3))
The output of program to convert pounds to kg in python is as follows:
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter weight in Pounds: 123
The weight in kgs is 55.792
Few important tips about this program:
1. First we ask the user to enter the weight in Pounds. Then we convert it to integer data type and then find its equivalent in kilograms.
2. If you want, you can convert the data type to float instead of string so that you can work with better precision while giving input.
3. Lastly, we use the round() function to round off the result upto three decimal places.
Python code converting pounds to kilograms snapshot:
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :
Published Date :
Nov 24,2021