def weight_g(g):
weight = round(g*0.001,3)
print(g,'g','=',weight,'kg')
g = int(input('请输入重量(g)'))
weight_g(g)
运行结果:
请输入重量(g)156
156 g = 0.156 kg
def weight_g(g):
weight = round(g*0.001,3)
print(g,'g','=',weight,'kg')
g = int(input('请输入重量(g)'))
weight_g(g)
运行结果:
请输入重量(g)156
156 g = 0.156 kg