Python re-introduces the covered built-in function, and python built-in function
Fortunately, this problem is easy to solve. We only need to use _ builtins __:
from __builtins__ import int as py_int
In this way, we can re-use the python int, but in this case it is called py_int.
The most common reason for overwriting a function or variable is that "*" is used for reference "*":
from something import *
When using import in this way, we cannot provide clear guidance on which variables or functions are introduced, or whether these variables or functions will overwrite the original variables or functions. therefore, this is one of the main reasons why "*" is not recommended during import.
In python 3, you can use builtins instead of _ builtins __.
Write a FUNCTION in PYTHON
>>> Def s (M ):
... If M = 1:
... Return 1
... Else:
... Return s (M-1) + 1.0/M
>>> Import math
>>> Def Gauss (x, m = 0, s = 1 ):
... Return (1/(math. sqrt (2 * math. pi) * s) * math. exp (-0.5 * (x-m)/s) ** 2)
...
>>> Li = [-5,-4,-3,-2,-,]
>>> Print map (Gauss, li)
[1.4867195147342977e-006, 0.00013383022576488537, 0.0044318484119380075, 0.053990966513188063, 0.24197072451914337, 0.3989422804014327, 0.24197072451914337, 0.053990966513188063, 0.0044318484119380075, 1.4867195147342977e-006]
>>>
Python function !!!!
Def isSquare (N ):
For I in range (1, N ):
If N = I * I:
Return True
Return False
Def isItemInList (L, item ):
If item in L:
Return True
Else:
Return False
Do you want to color this triangle?