Wednesday 10 June 2020

Write a program to print NUMPY array element which are not divisible by 5

Python Program:

# import numpy module
import numpy as np  

# creating numpy array 
temp = np.array([2,5,8,10,20,25,31]) 

# storing the array elements which # are not divisible by 5
elements_divisible_by_5 = temp[temp%5 != 0]   

print(elements_divisible_by_5)

Output:



1 comment: