1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GalinKa [24]
3 years ago
15

Def transfer(bank, log_in, usera, userb, amount): ''' in this function, you will try to make a transfer between two user account

s. 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:
Computers and Technology
1 answer:
Vlad [161]3 years ago
3 0

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.

<h3>Writing code in python:</h3>

<em>def transfer (bank, log_in, userA, userB, amount):</em>

<em>if userA in bank and log_in[userA]:</em>

<em>  if userB in log_in:</em>

<em>    if amount <= bank [userA]: </em>

<em>      bank [userA] -= amount</em>

<em>      bank[userB] += amount </em>

<em>      return true </em>

<em>  return false </em>

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

<em>  log_in= {"Bradon": False, "Jack": False, "James": False, "Sarah": False}</em>

<em>  transfer(bank, log_in, "Bradon", "Jack", 100)</em>

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

#SPJ1

You might be interested in
HELP GENIUS Rank :))) DoNT answer If you don't know
RideAnS [48]

An instance in my life where I rendered services was when I worked in a grocery store.

The roles of entrepreneur include:

  • Allocating employees duties.
  • Improving standard of living.
  • Taking risks.

The three challenges that a young entrepreneur faces today include:

  • Financial instability.
  • Conflicts with education.
  • Lack of business skills.

The top three characteristics of an entrepreneur include:

  • Innovation.
  • Confidence
  • Risk taking

<h3>Who's an entrepreneur?</h3>

It should be noted that a entrepreneur is an individual who owns business and take risks.

The roles of entrepreneur include allocating employees duties, improving standard of living, and taking risks

Learn more about entrepreneur on:

brainly.com/question/353543

#SPJ1

3 0
1 year ago
Httpsdiscord.ggBVNuFMgG link is here<br>come and join discord​
DedPeter [7]

Answer:

httpsdiscord.ggBVNuFMgG

5 0
3 years ago
1. an image can be stored either in a vector graphic file or in a bitmap file true or false
lions [1.4K]

Answer:

1 true 2 true 3 false 4 true

Explanation:

7 0
3 years ago
What can you do if brainstorming only gives you a small or incomplete idea?
Grace [21]

Answer:

D. All of the above

Explanation:

5 0
3 years ago
Assume you're using a three button mouse. to access shortcut menus, you would
Likurg_2 [28]
<span>Normally you would click the right hand/secondary mouse button but you may configure any of the buttons to work within the Keyboard and Mouse section of System Preferences.
Hope this helps:)</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • DJ wants to see how his document will look when printed. Where would he find the button to see the document in print view? the P
    5·2 answers
  • You are creating a budget for your new business.What should you include
    15·1 answer
  • Is a computer network that spans a relatively small area, allowing all computer users to connect with each other to share data a
    13·1 answer
  • Which of the following is NOT considered a step in the problem solving process. A Try B Discover C Prepare D Define
    12·1 answer
  • 4-Translate the following C program to MIPS assembly program (Please explain each instruction in your code by a comment and subm
    6·1 answer
  • A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the clie
    8·1 answer
  • Do you get notified if someone follows you on Spotify like your email or do you just have to find out on your own
    14·1 answer
  • Which descriptions offer examples of Correction Services workers? Select all that apply.
    8·1 answer
  • The owner of a candle shop has asked for your help. The shop sells three types of candles as shown below:
    9·1 answer
  • Professional communication must be objective,
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!