Print odd numbers in a List - Python Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report We are given a list and our task is to print all the odd numbers from it. This can be done using different methods like a simple loop, list comprehension, or the filter() function. For example, if the input is [1, 2, 3, 4, 5], the output will be [1, 3, 5].Using LoopThe most basic way to print odd numbers in a list is to use a for loop with if conditional check to identify odd numbers. Python a = [10, 15, 23, 42, 37, 51, 62, 5] for i in a: if i % 2 != 0: print(i) Output15 23 37 51 5 Explanation:Loops through list a.For each element i, checks if i % 2 != 0 (i.e., if the number is odd).If the condition is true then print the odd number.Using List ComprehensionList comprehension is similar to the for loop method shown above but offers a more concise way to filter odd numbers from a list. Python a = [10, 15, 23, 42, 37, 51, 62, 5] res = [i for i in a if i % 2 != 0] print(res) Output[15, 23, 37, 51, 5] Explanation: This list comprehension filters all elements in a where i % 2 != 0 (i.e., the number is odd).Using filter() FunctionThe filter() function can also be used to filter out odd numbers. The filter() function applies a function to each item in the iterable and returns a filter object containing only those items where the function returns True. Python a = [10, 15, 23, 42, 37, 51, 62, 5] res = filter(lambda x: x % 2 != 0, a) print(list(res)) Output[15, 23, 37, 51, 5] Explanation:filter() function takes two arguments: a lambda function (lambda x: x % 2 != 0) that checks if the number is odd and the iterable 'a'.The result is a filter object which we convert to a list and print.Related Articles:Python For LoopsList Comprehension in Pythonfilter() in python Python program to Print Odd Numbers in a List Comment More infoAdvertise with us Next Article Print even numbers in a list - Python S Shivam_k Follow Improve Article Tags : Python python-list Python list-programs Practice Tags : pythonpython-list Similar Reads Print even numbers in a list - Python Getting even numbers from a list in Python allows you to filter out all numbers that are divisible by 2. For example, given the list a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], you might want to extract the even numbers [2, 4, 6, 8, 10]. There are various efficient methods to extract even numbers from a li 3 min read Print even numbers in a list - Python Getting even numbers from a list in Python allows you to filter out all numbers that are divisible by 2. For example, given the list a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], you might want to extract the even numbers [2, 4, 6, 8, 10]. There are various efficient methods to extract even numbers from a li 3 min read Print Numbers in an Interval - Python In this article, we are going to learn how to print numbers within a given interval in Python using simple loops, list comprehensions, and step-based ranges.For Example:Input : i = 2, j = 5Output : 2 3 4 5Input : i = 10, j = 20 , s = 2Output : 10 12 14 16 18 20Letâs explore different methods to prin 2 min read Print Numbers in an Interval - Python In this article, we are going to learn how to print numbers within a given interval in Python using simple loops, list comprehensions, and step-based ranges.For Example:Input : i = 2, j = 5Output : 2 3 4 5Input : i = 10, j = 20 , s = 2Output : 10 12 14 16 18 20Letâs explore different methods to prin 2 min read Print lists in Python Printing a list in Python is a common task when we need to visualize the items in the list. There are several methods to achieve this and each is suitable for different situations. In this article we explore these methods.The simplest way of printing a list is directly with the print() function:Pyth 3 min read Python program to print positive numbers in a list In this article, we will explore various methods to o print positive numbers in a list. The simplest way to do is by using for loop function. Using LoopThe most basic method for printing positive numbers is to use a for loop to iterate through the list and check each element.Pythona = [-10, 15, 0, 2 1 min read Like