Python Pounds to Kilograms Conversion Program

By | July 27, 2019

Python Pounds to Kilograms Conversion Program – This Python Programming Tutorial will explain the Python code to input weight in pounds and convert into kilograms.

The Formula for the Pounds to Kilograms Conversion

e will use the following formula to convert the given pounds in kilograms.

1 Pound = 0.453592 Kilograms
or 1 lb = 0.453592 Kg

Python code to convert Lbs into Kgs will use:

1. Python print() function to show messages, values and results.
2. input() function for getting input in pounds from the user
3. float() function to convert the numeric string returned by input function into numeric value.
4. The Python assignment statement to calculate the formula for Lbs to Kgs Conversion.

"<yoastmark

The Source Code of  Python Pounds to Kilograms Conversion Program

# Write a program that asks the user
# to enter a weight in pounds.
# The program should convert it to kilograms.
# using the formula
# 1 Pound = 0.453592 Kilograms
# or 1 Lb = 0.453592 Kg
# Author: www.EasyCodeBook.com (c)

pounds = float(input('Enter weight in Pounds(Lbs) to Convert into Kilograms:'))
kilo_grams = pounds * 0.453592
print(pounds,' Pounds (Lbs) are equal to', kilo_grams,'Kilograms (Kgs)')

The output of Lbs to Kg Python Code

Enter weight in Pounds(Lbs) to Convert into Kilograms:10
10.0  Pounds (Lbs) are equal to 4.53592 Kilograms (Kgs)

Another output from a second sample run of the program:

Enter weight in Pounds(Lbs) to Convert into Kilograms:135
135.0  Pounds (Lbs) are equal to 61.23492 Kilograms (Kgs)

 

The Output from a Sample Run of the Python Program

Enter weight in Pounds(Lbs) to Convert into Kilograms:40.50
40.5 Pounds (Lbs) are equal to 18.370476 Kilograms (Kgs)

Another:

Enter weight in Pounds(Lbs) to Convert into Kilograms:500
500.0 Pounds (Lbs) are equal to 226.796 Kilograms (Kgs)

Another sample Run:

Enter weight in Pounds(Lbs) to Convert into Kilograms:170
170.0 Pounds (Lbs) are equal to 77.11064 Kilograms (Kgs)

 

2 thoughts on “Python Pounds to Kilograms Conversion Program

  1. Lamont Barfuss

    This page reminds me of the other page I found earlier

    Reply
  2. sirglio frei

    That is very interesting, You’re an excessively professional blogger. I have joined your rss feed and sit up for seeking extra of your fantastic post. Additionally, I have shared your site in my social networks!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *