python习题12,,ex121 age
python习题12,,ex121 age
ex12
1 age = input("How old are you?")2 height = input("How tall are you?")3 weight = input("How much do you weight?")4 5 print(f"So,you‘re {age} old, {height} tall and {weight} heavy.")
在终端上键入python -m pydoc input
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. On *nix systems, readline is used if available.
*pydoc命令的用法(目前看不懂)
1. python -m pydoc input:查看纯文本帮助信息,类似于函数的帮助说明。
(纯文本帮助)
2. python -m pydoc atexit :在当前目录创建atexit.html
python -m pydoc -p 5000 :启动一个web服务器监听 http://localhost:500/
(html帮助)
3.pydoc还为__builtins__添加了一个函数help(),从而可以在解释器窗口访问同样的信息。
(交互式帮助)(看不懂)
*python open() 函数用于打开一个文件,创建一个file对象,相关的方法才可以调用它进行读写。
连在一起试试看
1 age = int(input("How old are you?"))2 height = int(input(f"I knew you are {age} old.How tall are you?"))3 weight = input("How much do you weight?")4 5 print(f"So,you‘re {age} old, {height} tall and {weight} heavy.")
python习题12
相关内容
- Python操作文件和目录,,要在Python程序
- python模块中requests参数stream,,PS:这个参数真没用
- python-json的用法,,使用json的两种场
- Win10(PowerShell)下Python命令行tab自动补全,,用Python,直接
- python处理数据库的返回数据,,上代码:import
- Python——格式化GMT时间,格式化时间,1.背景最近在做视
- python 求阶乘之和。求1+2!+3!+...+20!的和,python求5的阶乘
- 踩过了这些坑,你真的懂python基础吗?,python里的坑
- Python更换镜像源,源镜像, 目录
- 使用python读取mat文件中的结构体数组,数组结构体,py
评论关闭