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
What is the impact of using computer in office?​
yawa3891 [41]

Answer:

It significantly enhance productivity.It can increase the speed and accuracy of many work processes, which improves overall worker efficiency. Documents can be written and edited much more quickly with the aid of a word processing program, and procedures, such as billing and accounting, can also occur more rapidly and with fewer errors.Computers in the office increase productivity not only in areas such as word processing, data management and information access, but also in information creation, collation and ultimately storage.

8 0
3 years ago
How would you define the term technology
ivanzaharov [21]
Technology is a way that most people are communicating now a days, whether it be with a phone, computer, etc. It’s is also how businesses can do things like making ad’s.

Not great at explaining things but you can probably make it sound a lot better by adding in your own word!
5 0
3 years ago
Circular error are caused by adding the cell name of a/an cell to aformula
ivanzaharov [21]
If you mean a "circular reference error" then you are correct. This error is caused by a formula in a cell that directly or indirectly refers to its own cell. For example, if you place a formula in cell A3 and your formula reads "=A1+A2+A3" you will receive a circular reference warning because the formula contains a reference to the cell that it is in (A3)
6 0
3 years ago
Binary calculation of 1110÷101​
NemiM [27]
10.90 not sure tho. POWKSKS
3 0
3 years ago
Read 2 more answers
Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els
RideAnS [48]

#include <stdio.h>

int main(void) {

int givenYear;

givenYear = 1776;

if(givenYear >= 2100){

printf("Distant future");

}

else if (givenYear >= 2001){

printf("21st century");

}

else if (givenYear >= 1900){

printf("20th century");

}

else {

printf("Long ago");

}

return 0;

}

3 0
3 years ago
Read 2 more answers
Other questions:
  • List five characteristics of a series circuit
    9·1 answer
  • Difference between video game laser and projectile
    9·1 answer
  • Which scientific law states that if a light source radiates isotropically, the light intensity falls off the further you get fro
    5·1 answer
  • Right click on a spot of your desktop that is not covered by an icon, window, or menu. when the menu comes up, play with the opt
    7·1 answer
  • the part of the computer that contains the brain , or central processing unit , is also known the what ?
    12·1 answer
  • Write a program that demonstrates the skills we've learned throughout this quarter. This type of project offers only a few guide
    14·1 answer
  • After Brooke has helped Simon to resolve his original problem, Simon asks her about another linked workbook he has received. The
    7·1 answer
  • A tiny spot on an LCD monitor display screen that permanently remains black when it should be activated and displaying color is
    12·1 answer
  • A variable is assigned a value on line 328 of a program. Which of the following must be true in order for the variable to work?
    12·2 answers
  • What is computer hadware​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!