Odd and Even using Append in python

How to Separate Odd and Even Numbers in Python

When you perform division operation on any number by 2 then it may give ‘0’ or ‘1’ if remainder is ‘0’ then that is an even number. if reminder ‘1’ then that is an odd number.


2%2 = 0 #Remainder is ‘0’ so it is even number

3%2 = 1 #Remainder is ‘1’ so it is odd number

Write an algorithm for Odd and Even Number in Python

step1: Start

step2: def variable(ABC):

step3: Take an empty set of odd and even

step4: Use loop in the number you given

step5: Check the condition if it’s true then append in even else odd 

step6: Return output

step7: Enter the number 

step8: print(def_variableName(pass_number))

step9: end


In this example we will see, how can we separate odd and even number using the append() method.

def odd_even(num):



for i in num:

if i%2 == 0:





return output_num


print('Odd and even numbers list:',odd_even(number))


C:\Users\Pramod\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Pramod/PycharmProjects/pythonProject/main.py
Odd and even numbers list: [[1, 3, 15, 7, 9], [2, 12, 6, 8]]

Process finished with exit code 0

Learn Complete Python In Simple Way

Click on enroll Button and watch the sample video then Go for Paid if you like.

Recommended Post:

Get Salesforce Answers

Hi, I’m Pramod Kumar Yadav & a computer science Engineer with 3years of experience in Digital marketing. I’m self-motivated and love to do SEO.

Best PYthon Course

Get More trending Courses

1 thought on “Odd and Even using Append in python”

Leave a Reply

%d bloggers like this: