Yes, you could use either
return "" or
def check_balance(account_type, checking_balance, savings_balance):
if account_type == 'savings':
balance = savings_balance
elif account_type == 'checking':
balance = checking_balance
print('Unsuccessful, please enter \"checking\" or \"savings\"')
balance_statement = 'Your ' + account_type + ' balance is $' + str(balance) + ' .'
That’s because anything after a
return statement doesn’t get executed, if I don’t use
return there, it will (only if both
elif didn’t run) print out the unsuccessful one as well as the balance_statement
In this case a print is the better option since returning a message is most likely going to be printed out, but in cases where the value is a number or boolean or in some cases a string, return is probably a better solution since after that you can do whatever you want to do with it.
I hope this helps