how to convert kg to g using python

try:
    Kg = int(input("kg:- "))
    To_gram = 1000*Kg
    print(Kg,"Kg = ",To_gram,"G")
except:
    print("Mile's must be number")

Here is what the above code is Doing:
1. It’s taking input from the user in the form of Kg.
2. Then it’s converting it into gram by multiplying it with 1000.
3. Then it’s printing the result.
4. If the user enters anything other than a number, it will show an error.