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]
2 years ago
8

Design the program in the following way:

Computers and Technology
1 answer:
natali 33 [55]2 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
Alicia uses a software application to store the names, email addresses, and phone numbers of her friends in alphabetical order.
Tomtit [17]
She is in spreadsheet.
3 0
3 years ago
Read 2 more answers
how to write a function "void funct()" which will accept a string from the user as input and will then display the string backwa
Mariulka [41]

Answer:

#include <bits/stdc++.h>

using namespace std;

void funct(){

   string name;

   cout<<"enter the string: ";

   cin>>name;

   

    reverse(name.begin(), name.end());

    cout<<"The string is : "<<name<<endl;

   

}

int main()

{

   funct();

 

  return 0;

}

Explanation:

create the function funct() with return type void and declare the variable type string and print a message for asking to used enter the string.  

The string enter by user is store in the variable using cin instruction.

after that, we use a inbuilt function reverse() which takes two argument.

firs argument tell the starting point and second index tell the ending point. then, the reverse function reverse the string.

name.begin() it is a function which return the pointer of first character of string.

name.end()  it is a function which return the pointer of last character of the string.

finally, print the reverse string.

for calling the function, we have to create the main function and then call the function.

5 0
2 years ago
What technology has a function of using trusted third-party protocols to issue credentials that are accepted as an authoritative
jarptica [38.1K]

Answer: PKI certificates

Explanation: PKI is known as the public key infrastructure which is commonly used for the encryption of the data and also for the data signing. They have the ability to assign the keys pair.

PKI certificates are in the form of strings of alpha-numeric running for a mathematical functions. They use the third party protocols for the execution and they are widely accepted by the authoritative identity.

5 0
2 years ago
Which of the following blocks is least similar to the others?
GuDViN [60]
The answer is A or B
4 0
3 years ago
Read 2 more answers
Which type of address is the ip address 232. 111. 255. 250?.
Nitella [24]

Answer:

It is either an internal IP address or it is a private IP address.

Explanation:

6 0
2 years ago
Other questions:
  • A drivers touches a cars steering wheel on a hot day which term refers to the way heat is transferredd to the drivers hand
    6·2 answers
  • Variable costs are __________.<br><br> A. decreasing<br> B. increasing<br> C. static
    10·1 answer
  • Predict how digital video will be viewed in the future. Step into the year 2028. How are people viewing digital video? Or have w
    13·2 answers
  • Oxnard Casualty wants to ensure that their e-mail server has 99.98 percent reliability. They will use several independent server
    14·1 answer
  • ________ consists of detailed, preprogrammed instructions that control and coordinate the computer hardware components in an inf
    11·1 answer
  • What is SoC? how is it different from CPU?
    14·1 answer
  • On Edge; this assignment has been overdue for like three weeks because I DO NOT understand what to do, if you could help me that
    12·2 answers
  • What are two options available for highlighting changes in the Highlight Changes dialog box?
    11·2 answers
  • LaShawn would like to post photos in a social media app, but the program needs to be modified in order to display a greater vari
    12·2 answers
  • search engines use software that combs the web to find webpages and add new data about them to the database. what is this softwa
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!