Use of modules
Two types of reference modules
Form one: Import module_name
Form two: From Module1 import Module11 (Module11 is a submodule of module)
Example: referencing the exact Division module
Import
The math module in Python needs to be used for operations such as Root, exponentiation, and logarithmic.
>>>Importmath>>> dir (Math)#View the features provided by this module [‘__doc__‘,‘__file__‘,‘__name__‘,‘__package__‘,‘ACOs‘,‘Acosh‘,‘Asin‘,‘Asinh‘,‘Atan‘,‘Atan2‘,‘Atanh‘,‘Ceil‘,‘Copysign‘,‘Cos‘,‘Cosh‘,‘Degrees‘,‘E‘,‘Erf‘,‘Erfc‘,‘Exp‘,‘Expm1‘,‘Fabs‘,‘Factorial‘,‘Floor‘,‘Fmod‘,‘Frexp‘,‘Fsum‘,‘Gamma‘,‘Hypot‘,‘Isinf‘,‘isNaN‘,‘Ldexp‘,‘Lgamma‘,‘Log‘,‘Log10‘,‘log1p‘,‘Modf‘,‘Pi‘,‘Pow‘,‘Radians‘,‘Sin‘, ' sinh " ' ' trunc ' ]>>> Help (Math.pow) See how to use the function Help on built- iny (X to the power of Y). END)
Enter Q to exit interactive mode in interactive mode
>>> Math.pow (4,2) # represents 4 of the powers of 16.0>>> Math.pow (3,2) 9.0
>>> 4**2
16
Python Learning Note 2-modules