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
Why do attackers tend to target public or private Wi-fi networks?
Anika [276]

Answer:

The answer to this question is given below in this explanation section.

Explanation:

A free WiFi connection in a public space can seem like a lifesaver when you are on the go.But if you decide to use public WiFi just be aware that you could be making yourself an easy target for hackers and putting your information and more at risk.

one of the dangers of using a public WiFi network is that data over this type of open  connection is often encrypted and  unsecured ,leaving you vulnerable to a man in the middle attack.It when a cyber criminal exploits a security  flaw in the network to intercept data

  • Avoid connecting to public WiFi connection. i if you must use a public WiFi hotpots also use a virtual privater network to secure your connection.
  • Do not  log in to password protected websites that contains sensitive information when using a public WiFi connection for example banking and social networking sites or even email.
  • Keep your software patched and up to date and all your devices even your mobiles ones to avoid any potential infection by viruses or malware if you do use unsecured public WiFi.

5 0
3 years ago
Which branch of science helps avoid or minimize stress related injuries at workplace? _____ is a branch of science that aims to
QveST [7]

Answer:

Ergonomics

Explanation:

We can get stress injuries in the workplace, and the study of the stress injuries at workplaces is a very important branch of scientific study currently, and all companies from all the fields are working on it, and so are the academic and research institutions. And this branch has gained heights in the past 10 years as companies want to increase worker productivity as well as bring down the downtime as well as various injury claims related to the job. And we know this branch as "ergonomics".

5 0
3 years ago
Which cloud computing element that gives a service provider the ability to dynamically allocate shared physical resources to mul
borishaifa [10]

Answer:

Resource Polling is the correct answer to the given question .

Explanation:

The Resource pooling is used in cloud computing frameworks that describe a situation where companies offer temporary and flexible resources to different clients .In the resource polling the programs can be changed to fit the needs of each client without making any adjustments visible to the client.

The main function of resource pooling that it grants a service provider the opportunity to dynamically allocate common physical resources to different clients based on the utilization criteria of each client.

5 0
3 years ago
Create a Card class that represents a playing card. It should have an int instance variable named rank and a char variable named
Helen [10]

Answer:

Explanation:

The following code is written in Java. It creates the Card class and then uses it to create a full house and print out the rank and suit of every card in that hand.

class Card {

   int rank;

   char suit;

   public Card(int rank, char suit) {

       this.rank = rank;

       this.suit = suit;

   }

   public int getRank() {

       return rank;

   }

   public char getSuit() {

       return suit;

   }

}

class CardTester {

   public static void main(String[] args) {

       Card card1 = new Card(3, '♥');

       Card card2 = new Card(3, '♠');

       Card card3 = new Card(3, '♦');

       Card card4 = new Card(2, '♦');

       Card card5 = new Card(2, '♣');

       System.out.println("Card 1: " + card1.getRank() + " of " + card1.getSuit());

       System.out.println("Card 2: " + card2.getRank() + " of " + card2.getSuit());

       System.out.println("Card 3: " + card3.getRank() + " of " + card3.getSuit());

       System.out.println("Card 4: " + card4.getRank() + " of " + card4.getSuit());

       System.out.println("Card 5: " + card5.getRank() + " of " + card5.getSuit());

   }

}

3 0
3 years ago
Explain why the computer is powerful working tool???​
notsponge [240]

Answer:

here ya go

Explanation:

A computer is a powerful tool because it is able to perform the information processing cycle operations (input, process, output, and storage) with amazing speed, reliability, and accuracy; store huge amounts of data and information; and communicate with other computers.

8 0
3 years ago
Other questions:
  • When pasting an object which has been copied from a different slide, where on the slide does the object paste, assuming nothing
    15·1 answer
  • Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Rom
    13·1 answer
  • What is the accounting equation?
    12·1 answer
  • A method's name and parameter list constitute the method's ____.
    13·1 answer
  • What emphasizes extensive user involvement in the rapid and evolutionary construction of working prototypes of a system to accel
    15·1 answer
  • A blue NFiPA label indicates: A) Health Hazard B) Special information C) Flammability D) Reactivity
    6·2 answers
  • A computer consists of both software and hardware. a)Define the term software​
    5·1 answer
  • Which tab on the ribbon in the folder window allows users to change how the contents of the folder are being shown?
    11·1 answer
  • In a _____, there is no skipping or repeating instructions. A. iteration B. sequence C. selection D. conditional
    10·1 answer
  • How many answer can you get daily
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!