Login using Social Account
     Continue with GoogleLogin using your credentials
Conditional operators (like <, >, etc.) are also applied element-wise.
e.g.
import numpy as np
m = np.array( [ 20, -5, 30, 40] )
m < [15, 16, 35, 36]
Output will be
array([ False, True, True, False], dtype=bool)
Now let us check for another condition
m< 25
Output will be
array( [ True, True, False, False], dtype=bool )
To get the elements below a value of 25, you can use the below syntax
m[m<25]
Output will be
array( [20, -5 ] )
Please follow the below steps:
(1) Please import the required libraries
import numpy as np
(2) Please create a NumPy array called U
, as shown below
U = np.array([ [ 22, 45], [90, 4 ] ] )
(3) Get all the elements of U
which are less than 45
, and print the result using the print()
function
print( << your code comes here>> )
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Loading comments...