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
lyudmila [28]
3 years ago
8

Design the program in the following way:

Computers and Technology
1 answer:
natali 33 [55]3 years ago
5 0

Answer:

d = {}

while True:

   name = input("Enter the name of the boat (Press Enter or q to stop): ")

   if name == "" or name == "q":

       break

   time = int(input("Enter the time (in seconds): "))

   d[name] = time

winner_name = min(d, key=d.get)

winner_time = min(d.values())

average_time = sum(d.values()) / len(d.values())

slowest_boat = max(d, key=d.get)

slowest_time = max(d.values())

print(f"Winner name: {winner_name} and its time: {winner_time}")

print(f"Average time: {average_time}")

print(f"Slowest boat: {slowest_boat} and its time: {slowest_time}")

Explanation:

*The code is in Python.

Create an empty map(dictionary) to hold the values

Create a while loop. Inside the loop:

Ask the user to enter the name of the boat. Check if the user presses Enter or q, using if and break

Ask the user to enter the time

Insert these values as key-value pair to the map

When the loop is done:

Find the winner_name, the min() function finds the minimum value in a list. In this case, the key=d.get creates a list of the values in the map. The min(d, key=d.get) returns the key of the minimum value

Find the winner_time, min(d.values()) returns the minimum time in our map

Find the average time, the sum() function, returns the sum of the values in a list. In this case, sums all the values in the map. The len() function finds the count of the values. If we divide the sum of times entered by the count of the times entered, we get the average time

Find the slowest_time, the max() function returns the max of the value in a list. In this case, the maximum value is the slowest time

Print the results

You might be interested in
Which component of a computer is its input device and what role does it play in a document?
hichkok12 [17]

a keyboard is a imput device that helps in writing in a document.

3 0
4 years ago
In a dark place you have only a match , a twig , campfire logs , and oil lamp and a candle which do you literally first /
ohaa [14]

Answer:

You would use a twig first :)

Explanation:

3 0
3 years ago
What are the services offered by web-based email?​
slega [8]

Answer:

Web based email is a service that allows to access and use electronic mail via web browser.

It allows clients to login into the email software running on a web server to compose, send and receive, delete mails basically.

8 0
3 years ago
The person or user associated in computer field is called​
marusya05 [52]

Explanation:

A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software.

6 0
3 years ago
Read 2 more answers
TOT al<br>Name TWO examples of these settings and utilities. (2)​
natulia [17]

Answer:

A program that performs a very specific task, usually related to managing system resources.

Explanation:

Compression utilities software.

Backup utilities software.

Disk defragmentation utilities software.

Text editor.

Application software.

The General purpose Application software.

5 0
3 years ago
Other questions:
  • An intranet is a way for a company or organization to protect copyrighted and other important information?
    15·2 answers
  • When using a graphics editing program, which option allows you to adjust the space around an image?
    15·1 answer
  • Write a Python function called validateCreditCard that takes 8-digit credit card number as the input parameter (string value) an
    8·1 answer
  • Which file extension indicates a Microsoft Excel document?
    7·1 answer
  • Answer to this if you have apex legends on either pc xbox one or PS4 for the one that answers and does gets brainliest please do
    7·2 answers
  • Match the command to the use. Test connectivity to a remote computer Test DNS lookup View packets in a transmission Display the
    14·1 answer
  • Anyone know how to fix black screen of death on computer​
    6·1 answer
  • Harry has created a Microsoft Excel workbook that he wants only certain people to be able to open. He should use
    13·1 answer
  • What type of html list will automatically place a list marker, or bullet point, indicator in front of each item? group of answer
    8·1 answer
  • CISC vs RISC processors might be used, and come up with environments where one processor would outperform the other.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!