vendredi 10 juillet 2020

If statement where if 3 of 5 conditions are true in Python

I was wondering how to have an if statement in python that will react to any 3 out of 5 conditions being true to make the if statement true.

    if (a>2) and (b>3) and (c>2) and (d>6) and (e>4):
       list.append(True)

This code would add true to the array "list" if all 5 conditions are met but I was wondering how to get it to work if any 3 of the 5 are true to then append true to "list"?

Aucun commentaire:

Enregistrer un commentaire