age = input("How old are you? ")
height = input("How tall are you? ")
weight = input('How much do you weight? ')
print(f"So, you're {age} old, {height} tall and {weight} heavy.")
练习
- In Terminal, where you normally run python3.6 to run your scripts, type pydoc input . Read whatit says. If you’re on Windows try python3.6 -m pydoc input instead.
- Get out of pydoc by typing q to quit.
- Look online for what the pydoc command does.
- Use pydoc to also read about open , file , os , and sys . It’s alright if you do not understand those;
答案
-
Help on built-in function input in module builtins:
input(prompt=None, /)
Read a string from standard input. The trailing newline is stripped.The prompt string, if given, is printed to standard output without a
trailing newline before reading input.If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
在命令行界面输入以下代码
python -m pydoc input
即可查询input函数用法
可尝试查询open、file、os、sys等含义
按q退出pydoc