Articles

Program to convert Pounds to Kilograms in Python

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:

python code converting pounds to kilograms

 


Basic Python Programs

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 & Data Science Enthusiast
Page Views :    Published Date : Feb 09,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!