I´m working on a small project to get some exercise in OOP, which should be a kind of Bank-Simulator.
How do i change the object to use a method on without checking each variant with if clauses? To example, how do I input the person to use display on based on the input without checking each person with an if clause?
class Bank:
  def __init__(self, name, balance):
    self.name = name
    self.balance = balance
  def transfer(self, recipient):
    amount = float(input('What amount do you want to transfer? \n'))
    if amount >= self.balance:
      self.balance -= amount
      recipient.balance += amount
    else:
      print('Your balance does not cover that transfer!')
  def display(self):
    print('Your balance is: ')
    print(self.balance)
person_one = Bank('Steve', 1000)
person_two = Bank('Bob', 1000)
while True:
  User = input('What is your name?')
  print('Which action would you like to take?')
  action = input('Your choices are display, deposit and withdraw \n')
  if action in ('display', 'deposit', 'withdraw'):
    if action == 'display':
      User.display()