Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Explore in-depth answers to your questions from a knowledgeable community of experts across different fields. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.

Def transfer(bank, log_in, usera, userb, amount): ''' in this function, you will try to make a transfer between two user accounts. bank is a dictionary where the key is the username and the value is the user's account balance. log_in is a dictionary where the key is the username and the value is the user's log-in status. amount is the amount to be transferred between user accounts (usera and userb). amount is always positive. what you will do: - deduct the given amount from usera and add it to userb, which makes a transfer. - you should consider some following cases: - usera must be in the bank and his/her log-in status in log_in must be true. - userb must be in log_in, regardless of log-in status. userb can be absent in the bank. - no user can have a negative amount in their account. he/she must have a positive or zero balance. return true if a transfer is made. for example:

Sagot :

Using the knowledge in computational language in python this code will be described for bank is a dictionary where the key is the username and the value is the user's account balance.

Writing code in python:

def transfer (bank, log_in, userA, userB, amount):

if userA in bank and log_in[userA]:

 if userB in log_in:

   if amount <= bank [userA]:

     bank [userA] -= amount

     bank[userB] += amount

     return true

 return false

 bank= {"Bradon": 115.5, "Patrick": 18.9, "Sarah": 827.43, "Jack": 45.0, "James": 128.87}

 log_in= {"Bradon": False, "Jack": False, "James": False, "Sarah": False}

 transfer(bank, log_in, "Bradon", "Jack", 100)

See more about python at brainly.com/question/18502436

#SPJ1

View image lhmarianateixeira
We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.