exercise 12

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.")

练习

  1. 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.
  2. Get out of pydoc by typing q to quit.
  3. Look online for what the pydoc command does.
  4. Use pydoc to also read about open , file , os , and sys . It’s alright if you do not understand those;

答案

  1. 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.

  2. 在命令行界面输入以下代码
    python -m pydoc input
    即可查询input函数用法
    可尝试查询open、file、os、sys等含义
    按q退出pydoc

你可能感兴趣的:(exercise 12)