Mar-10-2022, 07:40 AM
Thank you both for sharing your these working scripts which are instructive.
I like how cleaner deanhystad's script looks with the
I was not trying protect against strings being passed in, nor ensuring only numerical (integer/float/Decimal) input. The way I formatted my exception was just a misunderstanding of how to properly raise them. Using a conditional as you two have used them makes much more sense.
I have incorporated all of your suggestions into the latest iteration of my script. I am taking my script to the next level with added features and more questions which I will follow up in a new thread later this morning.
Thanks again goes out to Yoriz and deanhystad.
I like how cleaner deanhystad's script looks with the
return
statements. The __repr__
is helpful too. Quote:Is this not understanding how to raise an exception for a negative balance, or are you protecting against amount not being a number? If the latter, shouldn't you do the same for deposits?
I was not trying protect against strings being passed in, nor ensuring only numerical (integer/float/Decimal) input. The way I formatted my exception was just a misunderstanding of how to properly raise them. Using a conditional as you two have used them makes much more sense.
I have incorporated all of your suggestions into the latest iteration of my script. I am taking my script to the next level with added features and more questions which I will follow up in a new thread later this morning.
Thanks again goes out to Yoriz and deanhystad.