w3resource
Python Exercises

Python: Find all the values in a list are greater than a specified number

Python List: Exercise - 67 with Solution

Write a Python program to find all the values in a list are greater than a specified number.

Sample Solution:-

Python Code:

list1 = [220, 330, 500]
list2 = [12, 17, 21]
print(all(x >= 200 for x in list1))
print(all(x >= 25 for x in list2))

Sample Output:

True                                                                                                          
False

Pictorial Presentation:

Python List: Find all the values in a list are greater than a specified number.
Python List: Find all the values in a list are greater than a specified number.

Flowchart:

Flowchart: Find all the values in a list are greater than a specified number

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to find the list in a list of lists whose sum of elements is the highest.
Next: Write a Python program to extend a list without append.

What is the difficulty level of this exercise?