Linux BashBash SnippetPython SnippetBasic未定長度函數參數1 2 3 def f(*a): for i in range(len(a)): print(i, a[i]) polynomal1 2 3 4 5 6 7 8 # polynomial(2, 4, 6, 8)(x) -> 2x^0 + 4x^1 + 6x^2 + 8x^3 def polynomial(*ai): def f(x): r = 0 for n, a in enumerate(ai): r += a*x**n return r return f Type AnnotationNumpy Array as Parameter1 def func(A: np.ndarray) stackoverflowNumpyDeterminant of array1 np.linalg.det(A) docMultiply a Matrix and a Array1 np.dot(A, x) stackoverflow