How to Create NumPy Arrays

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

# import numpy
# from numpy import *
import numpy as np
# ar0=np.array(100)
# print(ar0.ndim)
# print(type(ar0))
# print(ar0)
ar1=np.array([5,10,20,30,40,50])

# print(ar1.ndim)
# print(type(ar1))
# print(ar1)

# ar2=np.array([[5,10,20],[30,40,50]])
# print(ar2.ndim)

# print(type(ar2))
# print(ar2)
# ar3=np.array([[1,2,3],[4,5,6],[7,8,9]])
# print(ar3.ndim)
# # print(type(ar3))
# print(ar3)

# ar3=np.array([[[5,10,20],[30,40,50]],[[5,10,20],[30,40,50]]])
# print(ar3.ndim)
# print(ar3.shape)

Program 2

import numpy as np
ar1=np.array([11,2,23,94,35,76,17,8,9])
print("Max=",ar1.max())
print("Min=",ar1.min())

 

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

courses
Image

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *