Lesson 1 of 0
In Progress

Odd Number Filter

Kedeisha June 8, 2023

Easy Challenge: Odd Number Filter

Given the following list of integers, write a single line of Python using list comprehension to create a new list that only contains the odd numbers from the original list.

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Explanation

This code creates a new list (odd_numbers) that consists of the odd numbers from the original list (numbers). It does this by iterating over each number in numbers and checking if it is odd (i.e., if num % 2 != 0).