mercredi 28 mars 2018

What's the diference between if with OR operators and if with multiple elif?

Example code (Python):

A:

if a == 1 OR b == 1:
something

B:

if a == 1:
    something

elif b == 1:
    something

What are advatages and disadvangates of both variants?

Aucun commentaire:

Enregistrer un commentaire