Python Program to Print all Odd Numbers in a Range Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report There are several ways to print odd numbers in a given range in Python. Let’s look at different methods from the simplest to the more advanced.Using for loop with if conditionIn this method, we iterate through all numbers in the range and check if each number is odd using the condition num%2! = 0. If true, the number is printed Python # Iterate through all numbers in the given range for num in range(1, 11): # check if a number is odd if num % 2 != 0: print(num) Output1 3 5 7 9 Let's explore some other methods to print all odd numbers in a range.Table of ContentUsing a for loop with step sizeUsing List ComprehensionUsing Bitwise AND (&) to Check Odd NumbersUsing filter() FunctionThe filter() function can be utilized to filter out elements from a sequence. You can use it in conjunction with a lambda function to print odd numbers.Using List ComprehensionThis method creates a list of odd numbers in one line using list comprehension with a conditional check num% 2! = 0. Python start = 1 end = 10 # Use list comprehension to create a list of odd numbers # Iterate through the range (start to end + 1) odd_numbers = [num for num in range(start, end + 1) if num % 2 != 0] print(odd_numbers) Output[1, 3, 5, 7, 9] Using Bitwise AND (&) bitwise AND operator is useful when we need to check if a number is odd or even. The binary representation of an odd number always ends in 1, while an even number ends in 0. So, we can check if a number is odd by using num & 1. Python start = 1 end = 10 for num in range(start, end + 1): # # Check if the last bit is 1 (odd number) if num & 1: print(num) Output1 3 5 7 9 Python Program to Print all Odd Numbers in a Range Comment More infoAdvertise with us Next Article Python Interview Questions and Answers S Shivam_k Follow Improve Article Tags : Python python-list Python list-programs Practice Tags : pythonpython-list Similar Reads Python Tutorial - Learn Python Programming Language Python is one of the most popular programming languages. Itâs simple to use, packed with features and supported by a wide range of libraries and frameworks. Its clean syntax makes it beginner-friendly. It'sA high-level language, used in web development, data science, automation, AI and more.Known fo 10 min read Python Interview Questions and Answers Python is the most used language in top companies such as Intel, IBM, NASA, Pixar, Netflix, Facebook, JP Morgan Chase, Spotify and many more because of its simplicity and powerful libraries. To crack their Online Assessment and Interview Rounds as a Python developer, we need to master important Pyth 15+ min read Python OOPs Concepts Object Oriented Programming is a fundamental concept in Python, empowering developers to build modular, maintainable, and scalable applications. OOPs is a way of organizing code that uses objects and classes to represent real-world entities and their behavior. In OOPs, object has attributes thing th 11 min read Python Projects - Beginner to Advanced Python is one of the most popular programming languages due to its simplicity, versatility, and supportive community. Whether youâre a beginner eager to learn the basics or an experienced programmer looking to challenge your skills, there are countless Python projects to help you grow.Hereâs a list 10 min read Python Exercise with Practice Questions and Solutions Python Exercise for Beginner: Practice makes perfect in everything, and this is especially true when learning Python. If you're a beginner, regularly practicing Python exercises will build your confidence and sharpen your skills. To help you improve, try these Python exercises with solutions to test 9 min read Python Programs Practice with Python program examples is always a good choice to scale up your logical understanding and programming skills and this article will provide you with the best sets of Python code examples.The below Python section contains a wide collection of Python programming examples. These Python co 11 min read Python Introduction Python was created by Guido van Rossum in 1991 and further developed by the Python Software Foundation. It was designed with focus on code readability and its syntax allows us to express concepts in fewer lines of code.Key Features of PythonPythonâs simple and readable syntax makes it beginner-frien 3 min read Python Data Types Python Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. Since everything is an object in Python programming, Python data types are classes and variables are instances (objects) of thes 9 min read Input and Output in Python Understanding input and output operations is fundamental to Python programming. With the print() function, we can display output in various formats, while the input() function enables interaction with users by gathering input during program execution. Taking input in PythonPython's input() function 7 min read Python Lists In Python, a list is a built-in dynamic sized array (automatically grows and shrinks). We can store all types of items (including another list) in a list. A list may contain mixed type of items, this is possible because a list mainly stores references at contiguous locations and actual items maybe s 6 min read Like