vendredi 19 juillet 2019

if vs if/else - Which one is preferred?

Consider the following snippets

condition=True
a=0
if condition:
    a+=8
else:
    a-=2
print(a) #8


condition=True
a=0
if condition:
    a+=10
a-=2
print(a) #8

Which one is preferred?

Aucun commentaire:

Enregistrer un commentaire