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
Unlike artistic drawings, which communicate self-expression and
Maurinko [17]

Answer:

The artistic drawings communicate self-expression and emotional content. However, when we come to manufacture or to construct a product, system, or device then you need to communicate its applications firstly, and then its features to prove why its the best choice as a product, system or device. And finally, you need to prove its affordable, if possible prove its still a luxury. And when we communicate size, shape and feature information, we need to prove its the best fit, and according to the requirement as well. Also, you need to prove its domain being quite vast such that more and more people with varied requirements show interest in buying it. And the shape is good in look as well. and features must be the best. If you are able to ensure these, your product, system or device is going to rock.

Explanation:

Please check the answer.

4 0
3 years ago
The most common type of local correction system is
STALIN [3.7K]
The answer is A county-based correctional system.  The most common type of local correction system is a county-based correctional system.  
6 0
3 years ago
What is the post condition of an expression or variable
Jet001 [13]

Answer:

The post condition is simply a statement expressing what work has been accomplished by the function. This work might involve reading or writing data, changing the values of variable parameters, or other actions.

8 0
3 years ago
Instead of typing out each co-worker's email address individually, you can use the Office Online People application to create a
arsen [322]

The answer is D) group

7 0
3 years ago
Read 2 more answers
Design the logic for a program that allows a usher to continuously enter numbers until the usher enters 0. Display the sum of th
uysha [10]

int sum = 0, n;

do {cin>>n; sum+=n;}while (n!=0);

cout<<sum;

5 0
3 years ago
Other questions:
  • In a game, your character cleverly places an electronic bug on an unsuspecting felon's jacket to track his movements. The bug tr
    10·2 answers
  • Why does a satellite requires two bridges?
    11·1 answer
  • Suppose that class OrderList has a private attribute double cost[100] which hold the cost of all ordered items, and a private at
    14·1 answer
  • What is the main difference between project tasks and client support tickets?
    11·1 answer
  • PLEASE HURRY I WILL GIVE BRAILIEST TO WHO EVER ANSWERS AND IS CORRECT
    14·2 answers
  • Can someone please type a code that makes a house in python and turtle graphics i need help
    9·1 answer
  • Describe all the steps a router goes through while deciding where to send the a packet. Explain why a router would choose one ro
    7·1 answer
  • Which insert image option allows a user to compile, modify, and add captions to images?
    5·2 answers
  • Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit. Use a floating-point number fo
    5·1 answer
  • According to behaviorism, instruction should provide necessary stimulus in order for
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!