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
Design and implement an application that reads an integer value representing a year from the user. The purpose of the program is
olga55 [171]

Answer :

Written in java

import java.util.Scanner;

public class Main{

   public static void main(String[] args) {

       int year;

       Scanner scanner = new Scanner(System.in);

       System.out.print("Please enter a year\n\n");

       year = scanner.nextInt();

       while (year < 1582) {

           System.out.print("\nPlease enter a different year above 1582\n");

           year = scanner.nextInt();

       }

       if (year % 4 == 0) {

           if(year % 100 ==0 && year % 400 != 0){

                   System.out.println(year + " is not a leap year\n\n");

           }else {

               System.out.println(year + " is a leap year\n");

           }

       } else {

           System.out.println(year + " is not a leap year\n\n");

       }

   }

}

4 0
3 years ago
Why did they removed the watch video button to view answers?​
MA_775_DIABLO [31]

Answer:

Umm I’m not sure

Explanation:

7 0
3 years ago
ANo _____ works by using the Internet to relay communications; it maintains privacy through security procedures and tunneling pr
dybincka [34]

Answer: virtual private network

Explanation:

A virtual private network, is normally refered to as a VPN is simply referred to as an encrypted connection which is done over the Internet. We should note that it usually take solace from a particular device to th network.

The function of the encrypted connection is to assist in the transmission of sensitive data. It works by using the Internet to relay communications and it maintains privacy through security procedures.

8 0
3 years ago
Why is Data-Driven Analytics of interest to companies?
vivado [14]

Answer:

It allows companies to make definitive predictions about the future. It gives companies the ability to make informed decisions.

It helps Data Analysts shape an analytics problem from a business problem.

Explanation:

4 0
3 years ago
What is collaboration software?
LenKa [72]
<span>I'm not sure but I do know Collaboration means working together toward a mutual goal. so I hope that helps at least a little </span>
7 0
3 years ago
Read 2 more answers
Other questions:
  • 4. The programmer who focuses on implementing the game mechanics, rules, and other elements essential for gameplay is the
    13·1 answer
  • Which of the following is NOT a sedimentary structure?
    8·2 answers
  • Perception is a simple process.
    11·2 answers
  • Which device or software application detects errors in system configurations?
    8·1 answer
  • Earthquakes happen in the Earth’s
    10·1 answer
  • List two ways to exit the room properties dialog box, saving changes to the room
    12·1 answer
  • A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, cell A3 contains 7. You enter in cell A4 the fo
    7·2 answers
  • 52. An assignment statement will:
    11·2 answers
  • Define horizontal scroll bar​
    6·2 answers
  • Question # 9
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!