I have a script that checks bools through if statements and then executes code. What I am trying to do is make it so that:
if variable a is True, check if b is True and execute code
if variable a is False, execute the same code mentioned before
A simplified version of what I currently have is this:
if a:
if b:
print('foo')
else:
print('foo')
Is there a better way to do this that doesn't require me to write print('foo') twice?
Aucun commentaire:
Enregistrer un commentaire