Computer Science, asked by kumarimanisha8251, 8 months ago

write a numpy program to extract all odd number from an array​

Answers

Answered by divyameher00
3

Answer:

Write a NumPy program to create an array of all the even integers from 30 to 70. Sample Solution : Python Code : import numpy as np array=np.arange(30,71,2) print("Array of all the even integers from 30 to 70") print(array) Pictorial Presentation: Python Code Editor: Have another way to solve this solution?

Explanation:

plz make me brainy

Answered by BlessingOfTheLord
0

Answer:

# extract all odd numbers from array

```

import numpy as np

array = np.arange(10)    # dummy array

result = []    # a seperate list for storing odd numbers

for i in array:

 if i % 2 != 0:

   result.append(i)

print(np.array(result)) # convert list to array

```

Explanation:

Loop through the array and append the odd numbers into a seperate list. After the loop convert the result list to array

Similar questions