Challenge: Remove Even Integers from List

Given a list of size n, remove all even integers from it. Implement this solution in Python and see if it runs without an error.

Introduction

Here is a short guide to these challenge lessons.

  1. The function definition is always given in the problem statement with the expected arguments and function name to be used as is in the solution. If you change it, your code will not compile
  2. The skeleton code given has a function definition which only has the # Replace this placeholder return statement with your code comment in the body, It’s just there as a placeholder. Delete it and add your code in.
  3. When you do get compile-time errors, they will sometimes refer to line numbers and code which you did not write. That is fine; that is just our evaluation code. When in doubt, refer to the solution given and paste that in.
  4. Sometimes you will have to return from functions in a form that aligns with the test cases. Your solution may not be incorrect, but the return value might not be what the evaluation code expects. For example, you might return two numbers in a list, but our test cases might expect a tuple. Watch out for that. Good luck! 🍀

Problem Statement

Implement a function that removes all the even elements from a given list. Name it remove_even(lst).

Input

A list with random integers.

Output

A list with only odd integers

Sample Input

my_list = [1,2,4,5,10,6,3]

Sample Output

my_list = [1,5,3]

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy