The plot of sin(x) vs x is given below, which is the output of the code that follows:
import numpy
from numpy import sin, pi
from matplotlib import pyplot as plt
x = numpy.linspace(-2*pi,2*pi,100)
ysin=sin(x)
def Create_plot(c, v):
plt.plot(c,v)
plt.ylabel("sin(x)")
plt.xlabel("x")
plt.title('Plot of sin(x) from -2pi to 2pi')
plt.show()
Create_plot(x,ysin)
The output for the adjacent code is give below:
[157, 91, 235]
[128, 80, 200]
[53, 35, 80]
X = [[1,5,10],
[2,4,8],
[1,2,3]]
Y = [[2,6,10],
[9,7,5],
[11,5,20]]
product = [[0,0,0],
[0,0,0],
[0,0,0]]
for i in range(len(X)):
for j in range(len(Y[0])):
for k in range(len(Y)):
product[i][j] += X[i][k] * Y[k][j]
for p in product:
print(p)