Write a program that prompts the user to enter the weight of a person in kilograms and outputs the equivalent weight in pounds. output both the weights rounded to two decimal places. (note that 1 kilogram equals 2.2 pounds.) format your output with two decimal places.

Respuesta :

I wrote this program in Python:

x = int(input("Enter Weight in Kilograms: "))

result = x*2.2

print("Your weight in Kilograms is: ","{0:.2f}".format(x), "\nYour weight in Pounds is: ","{0:.2f}".format(result))

In Python programming the value of 'x' even though it is in the INT format, will still allow the program to get the decimal places.

The "results" will simply return the full float of the inputted value. The addition of the "{0:.2f}.format(variable)" is used to limit the number of decimal places that will be displayed.