×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Find Odd and Even Numbers from the List of Integers in Python

Here, we will learn how to find odd and even numbers from the list of integers using Python program? By Anamika Gupta Last updated : April 13, 2023

Logic to Find Odd and Even Numbers

To find odd and even numbers from the list of integers, we will simply go through the list and check whether the number is divisible by 2 or not, if it is divisible by 2, then the number is EVEN otherwise it is ODD.

Python Program to Find Odd and Even Numbers from the List of Integers

# Give number of elements present in list
n=int(input())

# list
l= list(map(int,input().strip().split(" ")))

# the number will be odd if on diving the number by 2 
# its remainder is one otherwise number will be even
odd=[]
even=[]

for i in l:
    if(i%2!=0):
        odd.append(i)
    else:
        even.append(i)

print("list of odd number is:",odd)
print("list of even number is:",even)

Output

Python program to print EVEN and ODD

Python Basic Programs »


Related Programs

Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.