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
#12
Try these two functions I made to help you understand

def is_dunder(property):
    return True if property[:2] == '__' else False

def print_properties(obj):
    [print(prop) for prop in dir(obj) if not is_dunder(prop)]
Create your instances in the repl BA and time_instance in your case and pass them to print_properties() to see what sorts of properties each instance has. To explain the code, its simple is_dunder simply checks the first two characters of property to see if they are '__' and returns a boolean. print_properties(obj) takes a instance object and prints each of the properties if they are not dunders.

This may help you understand.
Apologetic Canadian, Sorry about that eh?
Reply


Messages In This Thread
RE: ATM machine (deposits/withdrawals) using OOP - by knackwurstbagel - Mar-13-2022, 12:20 AM

Forum Jump:

User Panel Messages

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