Python解题目(第四十八题)

133 阅读1分钟
分三行输入姓名、年龄、体重,将这三个输入内容组成如下句型并输出:

  我是(姓名),今年(年龄)岁,体重(体重)斤。
注意:无需任何输入提示信息

输入格式及样例:
按顺序分三行输入姓名、年龄、体重,如:

张三
18
179.98
输出格式及样例:
我是(姓名),今年(年龄)岁,体重(体重)斤。其中体重保留两位小数。例如:

我是张三,今年18岁,体重179.98斤。
name = input()
age = int(input())
weight = float(input())

output = f"我是{name},今年{age}岁,体重{weight:.2f}斤。"
print(output)

输入:

张三
18
179.98

输出:

我是张三,今年18岁,体重179.98斤。