Similar to the case of using any(), we can also use a method that allows us to check whether all conditions are met. This can also greatly reduce the complexity of the code since you do not need to use multiple and checks.

Let us see this with an example.

Let us assume that we have the following conditions where we are checking whether we have more than 50 points in each school course:

 math_points = 51
 biology_points = 78
 physics_points = 56
 history_points = 72
 ​
 my_conditions = [math_points > 50, biology_points > 50,
                  physics_points > 50, history_points > 50]

Now passing all of them means that each condition should be met. To help us with that, we can simply use all(), as can be seen in the following snippet:

 if all(my_conditions):
     print("Congratulations! You have passed all of the exams.")
 else:
     print("I am sorry, but it seems that you have to repeat at least one exam.")

After we execute that, we are going to see the following printed in the console:

 Congratulations! You have passed all of the exams.

That’s pretty much it.

I hope you find this useful.