Reputation: 97
I have a code that looks:
if condition1:
do1
if condition2:
do2
else:
do3
else:
do3
where do2
and do3
operate on the same variables. Is there a way to reduce this code somehow, to avoid having do3
twice?
Thanks!
Upvotes: 1
Views: 106
Reputation: 673
I would think of something like this to avoid do3 twice
if condition1:
do1
elif condition2:
do2
else:
do3
Upvotes: 1