write a program in python to input weight in gram and display it in KG and gram
(write for class 9 level)
Answers
Answered by
3
Answer:
kilograms = float(input("Please enter kilograms:"))
grams = kilograms * 1000
print(grams, " Grams")
Explanation:
Answered by
5
Explanation:
grams = float(input("Please enter grams:"))
Ans_kilograms = int(grams / 1000)
Ans_grams = int(grams%1000)
print(Ans_kilograms, " Kilogram(s) and ", end='')
print(Ans_grams, " gram(s))")
Program explained:
- The first line gets the input in grams
- Next, the gram is divided by 1000 to convert gram to kilogram. Only integer part is obtained because the integer part indicates kilogram.
- Then the grams part is identified using "%" (modulus) operator and once again the integer part is obtained.
- Finally we print both the answer without any space using end =""
To Know More:
https://brainly.in/question/5009497
Write a program in python to convert fahrenheit to celsius
https://brainly.in/question/10053815
Write a Python program to convert a string to a list.
Similar questions
History,
5 months ago
English,
5 months ago
Social Sciences,
11 months ago
Biology,
11 months ago
Math,
1 year ago