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
Why does Linux make use of tasklets (i.e., software interrupts) instead of executing all interrupt-related activity in the (hard
Eddi Din [679]

Answer:

Although some devices can be controlled using nothing but their I/O regions, most real devices are a bit more complicated than that. Devices have to deal with the external world, which often includes things such as spinning disks, moving tape, wires to distant places, and so on. Much has to be done in a time frame that is different from, and far slower than, that of the processor. Since it is almost always undesirable to have the processor wait on external events, there must be a way for a device to let the processor know when something has happened.

That way, of course, is interrupts. An interrupt is simply a signal that the hardware can send when it wants the processor's attention. Linux handles interrupts in much the same way that it handles signals in user space. For the most part, a driver need only register a handler for its device's interrupts, and handle them properly when they arrive. Of course, underneath that simple picture there is some complexity; in particular, interrupt handlers are somewhat limited in the actions they can perform as a result of how they are run.

5 0
3 years ago
A software program installed without the user's knowledge and designed to alter the way a computer operates or to cause harm to
RSB [31]

Answer:

The correct answer for the given question is "Computer virus"

Explanation:

A computer virus is a software program that is installed automatically without user's knowledge and designed to duplicate itself .The main purpose of computer virus is to harm the computer system.

Some of the points regarding computer virus

1.The computer virus contain malicious software Which harm the computer system.

2.It damage the  computer computer system in such away that sometimes users will unable to access some certain functionality of computer system.

5 0
3 years ago
Namespaces cannot have namespaces as members.<br><br> True<br><br> False
Anna71 [15]

Answer:

False

Explanation:

namespaces can be nested. That is we can have a hierarchy of namespaces.

For examples suppose we have a namespace top. Within this we have another namespace first. At the next level we have a namespace called second. Then we have a class MyClass as a member of this namespace second. Then the complete description of the class will be as follows:

top::first::second::MyClass

5 0
4 years ago
When date is processed into a meaningful form, i becomes _______.
mrs_skeptik [129]

Answer:

When date is processed into a meaningful form, it becomes information.

6 0
3 years ago
Can the police track a phone if you post something on a social media platform even if the SIM card is out and location services
IgorLugansk [536]
Yes by using the internet address
6 0
3 years ago
Read 2 more answers
Other questions:
  • In object-oriented analysis, objects possess characteristics called _____.â
    14·1 answer
  • In Windows 2000 and later, the ____ command shows you the file owner if you have multiple users on the system or network.
    15·1 answer
  • Ethics in businesses and organizations are made up of a set of moral principles that guide the organizations. Discuss how good w
    8·1 answer
  • What is generalization error in terms of the SVM? a. How accurately the SVM can predict outcomes for unseen data b. How far the
    5·1 answer
  • Microsoft ____________________ is a complex, full-featured firewall that includes stateful packet filtering as well as proxy ser
    10·1 answer
  • g You are looking to rob a jewelry store. You have been staking it out for a couple of weeks now and have learned the weights an
    10·1 answer
  • What is the purpose of the domain name system
    15·2 answers
  • Pls help me to answer this question ASAP
    6·1 answer
  • Explain the role of protocol and standard organization in facilities interoperability in nertwork communication ​
    13·1 answer
  • What is an example of an intelligent automation solution that makes use of artificial intelligence?.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!