Wednesday, 28 October 2020

Array using Numpy and List in PythonTuple

 Hi all

Array can be implemented in Python using two methods

####Numpy

import numpy as np

hup=np.arange(10)

hup=np.zeros(10)

for i in range(10):

hup[i]=i**2


print(hup)

############

#Using List

a=[]

for i in range(10):

a.append(i**3)

print(a)


a = np.array([[10],
              [01]])
b = np.array([[41],
              [22]])
c=np.matmul(a, b)
print(c)

No comments:

Post a Comment