欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

笨办法学Python 3 习题11

程序员文章站 2022-06-15 18:37:48
...

[交作业啦]
ex11.py

# 不要用换行符(\n)结束这一行
print("How old are you?", end = ' ')
age = input()
print("How tall are you?", end = ' ')
height = input()
print("How much do you weight?", end = ' ')
weight = input()

# f-string
print(f"So, you are {age} old, {height} tall and {weight} heavy.")

会话

PS E:\lpthw> python .\ex11.py
How old are you? 31
How tall are you? 158cm
How much do you weight? 45kg
So, you are 31 old, 158cm tall and 45kg heavy.
PS E:\lpthw>

[学习心得]
input()函数接收一个标准输入数据,返回为string类型。