Program to convert a tuple into a NumPy array

In this python numpy program, we will convert a tuple into a NumPy array.

Steps to solve the program
  1. Import the numpy library as np.
  2. Convert a tuple into an array using np.asarray().
  3. Print the output.
				
					import numpy as np
x = np.asarray((5,7,0))

print(x)
				
			

Output :

				
					[5 7 0]
				
			

round off the elements in an array using ceil function.

create an array using dtype as complex.

Leave a Comment