Use the all() function with a generator expression:

>>> my_list1 = [30, 34, 56]
>>> my_list2 = [29, 500, 43]
>>> all(i >= 30 for i in my_list1)
True
>>> all(i >= 30 for i in my_list2)
False

Note that this tests for greater than or equal to 30, otherwise my_list1 would not pass the test either.

If you wanted to do this in a function, you'd use:

def all_30_or_up(ls):
    for i in ls:
        if i < 30:
            return False
    return True

e.g. as soon as you find a value that proves that there is a value below 30, you return False, and return True if you found no evidence to the contrary.

Similarly, you can use the any() function to test if at least 1 value matches the condition.

Answer from Martijn Pieters on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-check-values-list-greater-given-value
Check if all the values in a list that are greater than a given value - Python - GeeksforGeeks
April 22, 2025 - Explanation: This code converts a to a NumPy array and uses np.all() to check if all elements are greater than b.
Discussions

Fastest way to check if a NumPy array contains n consecutive copies of the same element?
What does one of your arrays look like? It’s unclear what “consecutive” means here if arrays aren’t 1D. [elem] * n in array seems like a good solution if it does what you want (don’t believe you actually need to convert array to a list for that line to work). More on reddit.com
🌐 r/learnpython
13
3
November 11, 2020
How to remove all values in a list above a certain value?
The basic way is largely as you say, although typically you'd look at creating a new list instead of deleting from the existing one. This may seem redundant but it exemplifies something we've generally learned about programming, which is that modifying stuff in place is generally more error prone (for programmers working with the item) in the long run than creating new things. If you're looking for the most typical language approach to deal with this though it's like this: filtered_list = [x for x in original_list if x <= max_value] This uses a concept called a "list comprehension" to construct a new list dynamically from the old one with conditions and transformations. There are other patterns such as the use of the builtin `filter` but they tend to only be better for specific edge cases. More on reddit.com
🌐 r/learnpython
46
13
March 15, 2024
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.greater.html
numpy.greater — NumPy v2.5 Manual
numpy.greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'greater'># Return the truth value of (x1 > x2) element-wise. ... Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
🌐
Statology
statology.org › home › numpy: count number of elements greater than value
NumPy: Count Number of Elements Greater Than Value
February 28, 2023 - import numpy as np vals_greater_10 = (data > 10).sum() This particular example will return the number of elements greater than 10 in the NumPy array called data.
🌐
Codegive
codegive.com › blog › numpy_check_if_any_element_is_greater_than.php
Numpy check if any element is greater than
When you use standard Python comparison operators (>, <, >=, <=, ==, !=) with NumPy arrays, they are applied element-wise. This means the operation is performed on each element of the array individually, and the result is a new array of the same shape, but containing boolean (True/False) values. # Check if each element in arr_1d is greater than 20 threshold_1d = 20 result_1d = arr_1d > threshold_1d print(f"Elements in {arr_1d} greater than {threshold_1d}:") print(result_1d) # Output: [False True False True False True] print("-" * 30)
🌐
w3resource
w3resource.com › python-exercises › numpy › python-numpy-exercise-31.php
NumPy: Get the values and indices of the elements that are bigger than 10 in a given array - w3resource
August 29, 2025 - Identify elements in a 2D array that are greater than 10 using np.where and validate the returned indices. Create a function that prints both the values and their indices for all elements exceeding a given threshold.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.greater.html
numpy.greater — NumPy v2.6.dev0 Manual
numpy.greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'greater'># Return the truth value of (x1 > x2) element-wise. ... Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
Find elsewhere
🌐
Codegive
codegive.com › blog › numpy_greater_than_or_equal_to.php
Numpy greater than or equal to
Using numpy greater than or equal to is straightforward. You simply apply the >= operator between a NumPy array and a scalar, or between two NumPy arrays. First, ensure you have NumPy imported: ... This is the most common use case, where you want to check if elements in an array are above a ...
🌐
w3resource
w3resource.com › python-exercises › numpy › basic › numpy-basic-exercise-53.php
NumPy: Numbers from a given array which are less and greater than a specified number - w3resource
August 28, 2025 - # Importing the NumPy library with an alias 'np' import numpy as np # Creating a NumPy array 'nums' containing values in a 3x3 matrix nums = np.array([[5.54, 3.38, 7.99], [3.54, 4.38, 6.99], [1.54, 2.39, 9.29]]) # Printing a message indicating the original array print("Original array:") print(nums) # Assigning value 5 to the variable 'n' and printing elements greater than 'n' in the array n = 5 print("\nElements of the said array greater than", n) print(nums[nums > n]) # Assigning value 6 to the variable 'n' and printing elements less than 'n' in the array n = 6 print("\nElements of the said array less than", n) print(nums[nums < n])
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.greater.html
numpy.greater — NumPy v2.0 Manual
numpy.greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'greater'># Return the truth value of (x1 > x2) element-wise. ... Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
🌐
APXML
apxml.com › courses › essential-numpy-pandas › chapter-4-fundamental-numpy-operations › logical-operations-arrays
NumPy Logical Operations
When you compare a NumPy array ... the scalar and each element of the array, returning a new boolean array of the same shape. import numpy as np # Create a sample array ages = np.array([25, 18, 65, 40, 12]) # Check which ages are greater than 21 is_adult = ages > 21 ...
🌐
TutorialsPoint
tutorialspoint.com › return-the-truth-value-of-an-array-greater-than-another-element-wise-in-numpy
Compare and return True if an array is greater than another array in Numpy
Python TechnologiesDatabasesComputer ... ... To compare and return True if an array is greater than another array, use the numpy.char.greater() method in Python Numpy....
🌐
TutorialsPoint
tutorialspoint.com › compare-and-return-true-if-a-numpy-array-is-greater-than-equal-to-another
Compare and return True if a Numpy array is greater than equal to another
To compare and return True if an array is greater than equal to another, use the numpy.char.greater_equal() method. The arr1 and arr2 are the two input string arrays of the same shape −
🌐
Tutorial Gateway
tutorialgateway.org › python-numpy-comparison-operators
Python numpy Comparison Operators
September 23, 2019 - The Python Numpy comparison operators and functions greater, greater_equal, less, less_equal, equal, and not_equal compare arrays & returnsTrue or false.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.greater.html
numpy.greater — NumPy v2.1 Manual
numpy.greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'greater'># Return the truth value of (x1 > x2) element-wise. ... Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.greater.html
numpy.greater — NumPy v2.3 Manual
numpy.greater(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'greater'># Return the truth value of (x1 > x2) element-wise. ... Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-greater-python
numpy.greater() in Python - GeeksforGeeks
March 8, 2024 - The numpy.greater() checks whether x1 is greater than x2 or not. Syntax : ... x1, x2 : [array_like]Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape out : [ndarray, boolean]Array of bools, or a single bool if ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › get-row-numbers-of-numpy-array-having-element-larger-than-x
Get Row Numbers of NumPy Array having Element Larger than X - GeeksforGeeks
September 29, 2025 - arr > X: Creates a boolean array marking values greater than X. np.any(.., axis=1): Checks each row to see if at least one element is True. np.where(...): Returns indices of rows where the condition holds.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.all.html
numpy.all — NumPy v2.1 Manual
Alternate output array in which to place the result. It must have the same shape as the expected output and its type is preserved (e.g., if dtype(out) is float, the result will consist of 0.0’s and 1.0’s).