In this problem, we are given a list by the user which may be the mixture of even and odd numbers and based on the concept of even and odd, we will split the list into two lists and one will contain only even numbers and another will contain only odd numbers. Before going to do this task, we will learn how to check the given number is even or odd in Python?
What are the even and odd number?
The number that can be fully divided by 2 is known as an even number and if the number is not divisible by 2 then it is known as an odd number.
Python program to check even or odd number
Output
Algorithm to extract even and odd number from the given list
Python program to check even or odd number from the given list
Output
append() method:
The function append use to add a number to an existing list. Here, we have used the append function to add an even number to list B and odd numbers to list C.
need an explanation for this answer? contact us directly to get an explanation for this answer