write a numpy program to extract all odd number from an array
Answers
Answered by
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
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
English,
4 months ago
English,
4 months ago
Biology,
4 months ago
Social Sciences,
8 months ago
World Languages,
8 months ago
CBSE BOARD X,
1 year ago
Math,
1 year ago