# Python Program to Print Odd Numbers in an Array

This Python Program uses the for loop range to Print the Odd Numbers in a Numpy Array. The if statement (if (oddArr[i] % 2 != 0)) checks the numpy array item at each index position is not divisible by two. If True, (print(oddArr[i], end = ” “)) print that numpy Odd array number.

```# Print Odd in Array
import numpy as np

oddArr = np.array([10, 25, 30, 65, 75, 50, 121])

print("**The List of Odd Numbers in this oddArr Array***")
for i in range(len(oddArr)):
if (oddArr[i] % 2 != 0):
print(oddArr[i], end = "  ")```

Print Odd Numbers in a Python Numpy Array output

``````**The List of Odd Numbers in this oddArr Array***
25  65  75  121  ``````

## Python Program to Print Odd Numbers in an Array using the For Loop

In this Python example, we used the numpy remainder and numpy mod functions to check the remainder of each array item divisible by two is not equal to zero. If True, print that Odd number from the numpy array.

```# Print Odd in Array

import numpy as np

oddArr = np.array([14, 23, 91, 18, 17, 89, 10])

print("**The List of Odd Numbers in this oddArr Array***")
for i in oddArr:
if (i % 2 != 0):
print(i, end = "  ")

print("\n\n=== Using numpy mod function===")
print("**The List of Odd Numbers in this oddArr Array***")
for i in oddArr:
if (np.mod(i, 2) != 0):
print(i, end = "  ")

print("\n\n=== Using numpy remainder function===")
print("**The List of Odd Numbers in this oddArr Array***")
for i in oddArr:
if (np.remainder(i, 2) != 0):
print(i, end = "  ")```

Print Python Numpy Array odd numbers using for loop output

``````**The List of Odd Numbers in this oddArr Array***
23  91  17  89

=== Using numpy mod function===
**The List of Odd Numbers in this oddArr Array***
23  91  17  89

=== Using numpy remainder function===
**The List of Odd Numbers in this oddArr Array***
23  91  17  89  ``````

Python Program to display Odd Numbers in a Numpy Array using the While Loop.

```# Print Odd in Array

import numpy as np

oddArr = np.array([4, 19, 21, 88, 65, 16, 11, 10, 5])
i = 0

print("**The List of Odd Numbers in this oddArr Array***")
while (i < len(oddArr)):
if (np.not_equal(oddArr[i] % 2, 0)):
print(oddArr[i], end = "  ")
i = i + 1```

Print Odd Numbers in a Python Numpy Array using a while output

``````**The List of Odd Numbers in this oddArr Array***
19  21  65  11  5  ``````

In this Python numpy array example, we created a function that finds and prints the Odd numbers.

```# Print Odd in Array

import numpy as np

def printOddNumbers(evenArr):
for i in oddArr:
if (np.remainder(i, 2) != 0):
print(i, end = "  ")

oddArr = np.array([1, 5, 22, 17, 10, 11, 35, 44, 98])

print("**The List of odd Numbers in this oddArr Array***")
printOddNumbers(oddArr)```