Python Programming - Arrays - Discussion
Discussion Forum : Arrays - General Questions (Q.No. 31)
31.
What is the output of the following NumPy code snippet?
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
result = np.where(arr % 2 == 0, "even", "odd")
print(result)
Answer: Option
Explanation:
The code uses
np.where()
to label even and odd numbers in the array.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers