Instagram
youtube
Facebook
Twitter

Python Program to Print All Odd Numbers in List

   Python Program to Print All Odd Numbers in List

    Code Description of the Program:

This Python program prints all odd numbers from a given list.
It uses a for loop to check each element, and if a number is not divisible by 2, it is       printed as an odd number.

    Explanation (Dot Points):

• A list is created with a set of numbers.
• A for loop is used to access each element in the list.
• The condition num % 2 != 0 checks if a number is not divisible by 2 (i.e., odd).
• If the condition is true, the number is printed.

Program:

my_list = [11, 22, 33, 44, 55, 66, 77, 88, 99, 100]

print("Odd numbers in the list are:")

for num in my_list:

    if num % 2 != 0:

        print(num)