Python program to print negative numbers in a list (original) (raw)

Last Updated : 13 Nov, 2025

In this article, we will explore multiple approaches to find and print negative numbers in a list.

**Example:

**Input: lst = [12, -7, 5, 64, -14]
**Output: -7, -14

Using List Comprehension

List comprehension provides a compact way to filter negative numbers while keeping the code readable.

Python `

a = [5, -3, 7, -1, 2, -9, 4]

n = [num for num in a if num < 0] print(n)

`

**Explanation:

Using filter() Function

The filter() function allows filtering elements based on a condition efficiently.

Python `

a = [5, -3, 7, -1, 2, -9, 4] n = list(filter(lambda x: x < 0, a)) print(n)

`

**Explanation:

Using a For Loop

A traditional for loop can be used to iterate through the list and print negative numbers directly.

Python `

a = [5, -3, 7, -1, 2, -9, 4]

for num in a: if num < 0: print(num)

`

**Explanation:

Using map() Function

Using map() is less straightforward since it requires handling None values for non-negative numbers.

Python `

a = [5, -3, 7, -1, 2, -9, 4]

negatives = [num for num in map(lambda x: x if x < 0 else None, a) if num is not None] print(negatives)

`