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
ANTONII [103]
2 years ago
5

On the classic gameshow The Price Is Right, contestants must guess the price of an object (guesses are distinct). The winner is

determined to be the person whose bid is closest to the correct price, but without going over. For example, if the guesses were Alice 430 Bob 538 Carol 487 David 550 and the true price were 520, then Carol has the winning bid with 487. With the same bids as above, if the actual price had been 420, then no one would win, as everyone bid too high. Your job is to implement a function with signature judge (auction, price) in which auction is a nonempty list of (person, guess) tuples and price is the actual price. The function must return the name of the winning person (or None, if no one wins). For example, the first scenario above might be expressed as judge( [('Alice', 430), ('Bob', 538), ('Carol', 487), ('David', 550)], 520) and the string 'Carol' should be returned as the winner. Your function may assume that all parameters are valid. []

Computers and Technology
1 answer:
Kruka [31]2 years ago
3 0

Answer:

The program code is in explaination

Explanation:

Program code below.

def judge(auction,price):

"""

Function: Returns Name who auctioned very near to give price

Input :

auction : list of tuples

price : auction price

output: returns name of best auction amount holder

"""

diff = [] #storing differences between auctionist amount and price

count = 0

for each_pair in auction:

if each_pair[1]<=price:

diff.append(price-each_pair[1])

else:

count+=1

diff.append(each_pair[1])

if count == len(auction): #check for if no one have auctioned good amount

return None

else:

more_possibility_index = diff.index(min(diff)) #finding index of best amount from diff list

return auction[more_possibility_index][0]

auction = [('Alice',430),('Bob',538),('Carol',487),('David',550)]

price = 520

print(judge(auction,price))

I kept the output at the attachment.

You might be interested in
The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
Feliz [49]

Answer:

Light text on a dark background

Explanation:

Microsoft PowerPoint is an application software in which the company ables to introduce themselves by making slides and presented to an audience in an easy and innovative way. In this,  we can add pictures, sound, video by adding the different text, colors, backgrounds, etc

For memorable and professional presentations, the light text on a dark background is a best combination as it is easy to read and give the best view of the message you want to convey.

8 0
3 years ago
Owen is writing a program that will lock his computer for one hour if the incorrect password is entered more than five times. Ha
kiruha [24]

Answer:

Your answer is <em>I think </em>A) A loop

Explanation:

In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.

5 0
3 years ago
What three best practices can help defend against social engineering attacks?
lina2011 [118]

The three best practices that can help protect against social engineering are:

  • Be watchful of instructions to click on enticing web links.
  • Educate employees regarding policies.
  • Avoid disclosing your login details.
<h3>Social engineering</h3>

This refers to online crimes that are socially engineered or designed to trick victims into providing certain information or carrying out certain actions that would cause unknown harm to them or others.

For example, they may be tricked into revealing their security information or other personal information via email correspondence.

You can learn more about social engineering here brainly.com/question/26072214

#SPJ12

6 0
2 years ago
Help!!
Eduardwww [97]

the undo option is the right answer



8 0
3 years ago
Read 2 more answers
What was the name of the first computer (machine) language?
Angelina_Jolie [31]

In 1957, the first of the major languages appeared in the form of FORTRAN. Its name stands for FORmula TRANslating system. The language was designed at IBM for scientific computing. The components were very simple, and provided the programmer with low-level access to the computers innards.


8 0
3 years ago
Read 2 more answers
Other questions:
  • You bought a monochrome laser printer two years ago. The printer has gradually stopped feeding paper. Which printer component sh
    14·1 answer
  • 1 megabyte is equal to 1024 gigabyte. True/False​
    11·2 answers
  • 2. What is an inanimate object? (1.0 points)
    14·1 answer
  • Use a switch statement to display "one" if the user has entered 1, "two" if the user has entered 2, and "three" if the user has
    14·1 answer
  • "What is the capital of Belarus?" is an example of what type of search query
    10·2 answers
  • Two threads try to acquire the same resource at the same time and both are blocked. Then, they continually change their states i
    14·1 answer
  • George works for a print newspaper in which of these areas would you be interested to hire new recruits for the newspaper WHICH
    11·1 answer
  • Mobile apps are replacing the old__________<br><br>​
    7·2 answers
  • Please help me in this question​
    7·2 answers
  • What are the nuclear codes?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!