Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# Create a program that can convert from kilograms to pounds, pounds to kilograms, liters to gallons, and gallons to liters.This program will help you develop your skills using input, output,...

Create a program that can convert from kilograms to pounds, pounds to kilograms, liters to gallons, and gallons to liters.

## How to do it?

When the program starts,theuser should be presented with a menu similar to the following:

`Please select the conversion you would like to do:1: Kilograms to Pounds2: Pounds to Kilograms3: Liters to Gallons4: Gallons to Liters5: ExitSelection (1-5): `

• After the user makes the selection, the program should prompt them for the value to convert. If the users input an invalid selection, the program should display:
• You have not typed a valid selection, please run the program again.
• The program should then exit.
• The output of the number should be formatted so that it has two decimal places.For example: 16.53
• The output should include the converted value and the converted units.

These are the conversion formulas:

 Conversion Formula Example Kilograms to Pounds Multiply the kilogram value by 2.2046 7.5 kilograms x 2.2046 = XXXXXXXXXXpounds Pounds to Kilograms Divide the pound value by 2.2046 25 pounds / 2.2046 = XXXXXXXXXXkilograms Liters to Gallons Divide the liter value by XXXXXXXXXX 2 liters / XXXXXXXXXX = XXXXXXXXXXgallons Gallons to Liters Multiply the gallon value by XXXXXXXXXX 5 gallons * XXXXXXXXXX = XXXXXXXXXXliters

## Sample output:

`Please select the conversion you would like to do:1: Kilograms to Pounds2: Pounds to Kilograms3: Liters to Gallons4: Gallons to Liters5: ExitSelection (1-5): 1Enter Kilograms 100220.46 Pounds `

Answered 1 days After Jan 26, 2024

## Solution

Bhaumik answered on Jan 27 2024
Conversion Program
Output:
Explanation:
Let us go through the code step by step to understand how it works:
1) Conversion Functions:
Â· The program defines four conversion functions: `kg_to_pounds`, `pounds_to_kg`, `liters_to_gallons`, and `gallons_to_liters`. These functions implement the conversion formulas provided in the problem statement.
2) Main Program (`main` function):
Â· The `main` function is where the main logic of the program resides. It runs in a loop until the user chooses to exit.
Â· Inside the loop: The user is presented with a menu using the `print` statements.
Â· The program attempts to get the user's selection as an integer using `int(input(...))`. If the user enters a non-integer value, a `ValueE
or` is caught, and an e
or message is displayed....
SOLUTION.PDF