Write a Python function negposzero () which takes a numpy array x as its input argu- ment. For each element of the array

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a Python function negposzero () which takes a numpy array x as its input argu- ment. For each element of the array

Post by answerhappygod »

Write A Python Function Negposzero Which Takes A Numpy Array X As Its Input Argu Ment For Each Element Of The Array 1
Write A Python Function Negposzero Which Takes A Numpy Array X As Its Input Argu Ment For Each Element Of The Array 1 (59.69 KiB) Viewed 18 times
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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply