# Python Program to Remove Odd or Even Numbers From a List

The list in Python is like the array of other programming languages. It is one of the most used built-in data structures in Python. So, during a Python coding interview, you may come across many questions based on Python lists. One of the questions you may get is to write a Python program to remove odd or even numbers from a list of numbers. So if you want to solve this question, this article is for you. In this article, I will present you with a tutorial on how to write a Python program to remove odd or even numbers from a list.

## Python Program to Remove Odd or Even Numbers From a List

If you are reading this article, I am sure you must be knowing what odd and even numbers are. An odd number is a number that does not give 0 as a remainder when divided by 2, and an even number is a number that gives 0 as a remainder when divided by 2. We can use the same logic to write a Python program to remove odd or even numbers from a list.

Below is how we can define a Python function to remove all the odd numbers from a Python list:

`[12]`

Just like the function defined above, below is how we can define a Python function to remove all the even numbers from a Python list:

`[15, 7, 9]`

Usually, in a Python coding interview, you might get this question as; how to write a Python program or define a Python function to remove all odd or even values from a Python list.

### Summary

So this is how you can write a Python program or define a Python function to remove all the odd or even values from a list. This list in Python is one of the most used built-in data structures, so during a Python coding interview, you may come across many questions based on Python lists. I hope you liked this article on how to write a Python program to remove odd or even values from a list. Feel free to ask your valuable questions in the comments section below.

##### Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of dataðŸ“ˆ.

Articles: 1537