Write a Python function negposzero () which takes a numpy array x as its input argu- ment. For each element of the array
Posted: Mon Jun 06, 2022 5:48 pm
Write a Python function negposzero () which takes a numpy array x as its input argu- ment. For each element of the array x, your function should display: the string "negative" if the element is negative (< 0) the string "positive" if the element is positive (>0) the string "zero" if the element is zero (0) Your code for function negposzero () should be within a Python script following the format shown below, in which you are asked to write the code for negposzero (): import numpy as np def negposzero (x): #your function code here np. random seed (1) x = np. random. randint (-5, 5, size=10) print (x) negposzero (x) When implemented correctly, your Python script should generate the output below. While the sample output is shown below for a particular choice of x. your function should work for arrays x of any length. [0340-5-5-42 14] zero positive positive negative. negative negative positive positive.