API's Using NumPy

import numpy as np
new_matrix = np.array([[1, 2, 3],[4, 5, 6],[7, 8, 9]])
 
print (new_matrix)
[[1 2 3]
 [4 5 6]
 [7 8 9]]
import numpy as np
 
# defining polynomial function
var = np.poly1d([2, 0, 1])
print("Polynomial function, f(x):\n", var)
 
# calculating the derivative
derivative = var.deriv()
print("Derivative, f(x)'=", derivative)
 
# calculates the derivative of after
# given value of x
print("When x=5  f(x)'=", derivative(5))
Polynomial function, f(x):
    2
2 x + 1
Derivative, f(x)'=  
4 x
When x=5  f(x)'= 20
import random

def Dice(n):
    sum = 0
    while n > 0:
        sum = sum + random.randint(1, 6)
        n -=1
    return sum

Dice(5) # Will output a range of 5 to 30
15