Saved Bookmarks
| 1. |
Write a program in python to input weight in gram and display it in KG and gram |
|
Answer» The following codes will have to be typed in script mode, saved and then executed. There are two POSSIBLE codes for this. One is to assign the formula into a variable, while the other is to directly type in the REQUIRED logic in the print statement. CODE 1: x = FLOAT(input("Enter your WEIGHT [in grams]:")) kg = x/1000 print("Your weight in Kilograms is", kg) CODE 2: x = float(input("Enter your weight [in grams]:")) print("Your weight in Kilograms is", x/1000) Both codes will PRODUCE the same output. |
|