Write a Python Program to Print Odd Numbers in a Set. The if statement (if(odval % 2 != 0)) checks whether the Set item divisible by two not equals to zero. If True, print that Odd number in a Set.
# Set Odd Numbers
oddSet = {26, 33, 19, 8, 41, 35, 12, 17}
print("Odd Set Items = ", oddSet)
print("\nThe Odd Numbers in this oddSet Set are:")
for odval in oddSet:
if(odval % 2 != 0):
print(odval, end = " ")

This Python Set Program allows to enter the set items and Print the Odd Numbers.
# Set Odd Numbers
oddSet = set()
number = int(input("Enter the Total Odd Set Items = "))
for i in range(1, number + 1):
value = int(input("Enter the %d Set Item = " %i))
oddSet.add(value)
print("Odd Set Items = ", oddSet)
print("\nThe Odd Numbers in this oddSet Set are:")
for odval in oddSet:
if(odval % 2 != 0):
print(odval, end = " ")

In this Python Set example, we created a (setOddNumbers(oddSet)) function that prints the Odd numbers.
# Tuple Odd Numbers
def setOddNumbers(oddSet):
for odval in oddSet:
if(odval % 2 != 0):
print(odval, end = " ")
oddSet = set()
number = int(input("Enter the Total Odd Set Items = "))
for i in range(1, number + 1):
value = int(input("Enter the %d Set Item = " %i))
oddSet.add(value)
print("Odd Set Items = ", oddSet)
print("\nThe Odd Numbers in this oddSet Set are:")
setOddNumbers(oddSet)
