Used early outs to reduce indentation

This commit is contained in:
2023-08-29 07:58:23 +00:00
parent 6a948fc69f
commit b51df093dc

View File

@@ -170,7 +170,7 @@ class StarlingClient:
if count == 0: if count == 0:
# I don't think this should happen! # I don't think this should happen!
print('This holder has no accounts.') print('This holder has no accounts.')
else: return
if count == 1: if count == 1:
print('This holder has one account:') print('This holder has one account:')
else: else:
@@ -187,18 +187,18 @@ class StarlingClient:
payees = self.payees().payees payees = self.payees().payees
count = len(payees) count = len(payees)
if count == 0: if count == 0:
print('There are no payees for this customer.') print('There are no payees for this account holder.')
else: return
if count == 1: if count == 1:
print('There is one payee for this customer:') print('There is one payee for this account holder:')
else: else:
print(f'There are {count} payees for this customer:') print(f'There are {count} payees for this account holder:')
for payee in payees: for payee in payees:
sys.stdout.write(f' {payee.payeeName} ({payee.payeeType}) - ') sys.stdout.write(f' {payee.payeeName} ({payee.payeeType}) - ')
count = len(payee.accounts) count = len(payee.accounts)
if count == 0: if count == 0:
print('no accounts.') print('no accounts.')
else: continue
if count == 1: if count == 1:
print('one account:') print('one account:')
else: else: