Method # 1: Using
We can use
all () to accomplish this particular task. In this we pass a condition and the validation of all elements is checked by
all () inside.
The original list: [4, 5, 8, 9, 10] Are all elements greater than 3? : True
Method # 2: Using
This function can also be used to code a solution this problem. In this, we just need to process the loop until the condition is met and increment the counter. If it matches the length of the list, then all elements meet this condition.
The original list : [4, 5, 8, 9, 10] Are all elements greater than 3? : True