Python Forum
ATM machine (deposits/withdrawals) using OOP
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ATM machine (deposits/withdrawals) using OOP
#6
Thank you both for sharing your these working scripts which are instructive.

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.
Reply


Messages In This Thread
RE: ATM machine (deposits/withdrawals) using OOP - by Drone4four - Mar-10-2022, 07:40 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020