dimanche 3 avril 2016

How can I structure this code to avoid repetition?

I have two conditions, a and b. One block of code should execute if a is true, then another if either a or b is true. Is there a better way to structure the code than the following - can I avoid the repeated test of a?

if a or b:
    if a:
        <block 1>
    <block 2>

Aucun commentaire:

Enregistrer un commentaire