Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to transfer money from one account to another, in a Python bank system?

I'm not having much luck finding any answers but how do I get the function def transfer_money to take a specified amount of money from the sender's account and add it to the receiver's account?

I have a menu where I type a number in it would carry out a specific task, number 1 as an example carries out the inputs of finding the amount to transfer and specifying the name of the sender and receiver

        if choice == 1:
            sender_lname = input("\n Please input sender surname: ")
            amount = float(input("\n Please input the amount to be transferred: "))
            receiver_lname = input("\n Please input receiver surname: ")
            receiver_account_no = input("\n Please input receiver account number: ")
            self.transfer_money(sender_lname, receiver_lname, receiver_account_no, amount)

After asking all these inputs, I have this function to carry out the transfer but I don't know how to start it off. I'm not a skilled programmer at the moment. I want to make it so it searches for the sender and receiver in accounts_list using their lastname but also with the account number of the receiver, then to take off that specified amount from the sender and add it to the receiver's account.

def transfer_money(self, sender_lname, receiver_lname, receiver_account_no, amount): 

Looking at other sources aren't helping and they're confusing me even more.

Comments