要显示模块math中的所有函数,使用的命令是:
A: importmath
B: dir(math)
C: help(math)
D: list(math)
A: importmath
B: dir(math)
C: help(math)
D: list(math)
B
举一反三
- 使用导入方式importmath时,如果函数与math模块中的某个函数同名,将被math模块中的同名函数覆盖。
- 要使用模块math,必须先导入该模块,正确的导入命令是: A: >>>import from math B: >>>import math from * C: >>>formmath import * D: >>>from import math *
- 如果想要查看math库中pi的取值是多少,可以利用以下()方式(假设已经执行了importmath,并且只要包含pi取值就可以)。 A: print(math.pi) B: dir(math) C: help(math) D: print(pi)
- 如果只需要math模块中的sin()函数,建议使用from math import sin来导入,而不要使用import math导入整个模块。
- 如果想要查看math库中pi的取值是多少,可以利用以下什么方式(假设已经执行了import math)? A: help(math) B: print pi C: dir(math) D: print math.pi
内容
- 0
引用math模块中sqrt函数的导入语句,下列错误的语句是:( ) A: import math B: from math import sqrt C: from sqrt import math D: from math import *
- 1
如果要从math模块导入sqrt函数,可以使用语句“from sqrt import math”。
- 2
以下导入模块的方式中,错误的是_______。 A: import math B: from math import pow C: from math import * D: from * import math
- 3
关于 import 引用,下列选项中描述错.误.的是 。 A: import 保留字用于导入模块或者模块中的对象 B: 使用 import math 可以引入 math 库 C: 使用 import math as m 可以引入 math 库并取别名 m D: 可以使用 from math import sqrt 引入 math 库
- 4
如果想要查看math库中pi的取值是多少,可以利用以下什么方式(假设已经执行了import math,并且只要包含pi取值就可以)? A: help(math) B: print(pi) C: dir(math) D: print(math.pi)