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
Mars2501 [29]
3 years ago
7

(1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the arr

ay's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 (2) Also output the total weight, by summing the array's elements. (1 pt) (3) Also output the average of the array's elements. (1 pt) (4) Also output the max array element. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 Total weight: 726.8 Average weight: 145.35999999999999 Max weight: 236.0
Computers and Technology
1 answer:
Mashutka [201]3 years ago
6 0

Answer:

weights = []

total = 0

max = 0

for i in range(5):

   weight = float(input("Enter weight " + str(i+1) + ": "))

   weights.append(weight)

   total += weights[i]

   if weights[i] > max:

       max = weights[i]

average = total / 5

print("Your entered: " + str(weights))

print("Total weight: " + str(total))

print("Average weight: " + str(average))

print("Max weight: " + str(max))

Explanation:

Initialize the variables

Create a for loop that iterates 5 times

Get the values from the user

Put them inside the array

Calculate the total by adding each value to the total

Calculate the max value by comparing each value

When the loop is done, find the average - divide the total by 5

Print the results

You might be interested in
What is the output of the following function call? //function body int factorial(int n) { int product=0; while(n > 0) { produ
maks197457 [2]

Answer:

zero

Explanation:

Because of the define the product variable is zero.

when the function call with pass by value 4.

The program control moves to that function, after that product

store the value zero. Then, product is multiply with n which become zero

because 0 * n is zero and store in the product again.

after that, n'' is wrong it must be 'n--' for performing the factorial function.

after that, the value of n is 3, again loop execute because condition n > 0

is true.

again zero multiply with n and become zero.

this process repeated until condition false and finally the output is zero.

Correction:

To make the code working:

change product = 1 instead of zero.

and change n-- in place of n''.  

5 0
3 years ago
What is 2D thinking and 3D thinking? i literally don't understand
andriy [413]

Answer:

Two dimensional thinking implies concepts that are flat or only partially representative of the whole. Three dimensional thinking implies the first part of 2d thinking conjoined with intersecting dimensions rendering a deeper field of meaning.

Explanation:

8 0
2 years ago
Is the Internet dangerous?
VARVARA [1.3K]

Many people would answer this in many different ways. In my personal opinion, it's a yes. It's a yes because it makes it easier for people to track you down (finding your iep) and it's easy for someone to take your identity. It's also dangerous for children and teens (even young adults) because there are many people wanting them, and wanting to meet them in public and things like that. I hope I answered your question! (:

8 0
2 years ago
Read 2 more answers
Is greedy algorithm non deterministic by nature?
Flura [38]

Answer: Yes

Explanation: Greedy algorithm is the algorithm that gives the solution to the problem on the basis of the piece by piece or step by step architecture.  the next step of the solution is based on the aim of solving problem optimally.But the steps chosen can be correct or incorrect.

Non-deterministic nature is the feature that determines that the  steps that is being chosen is not the most optimal one and no high surety is present.Thus, this nature is present in the greedy algorithm and it has non-deterministic nature.

7 0
3 years ago
Create a class ProblemSolution with following characteristics Two private member variables name & designation of string type
Romashka-Z-Leto [24]

Answer:

Please see the attachment for the solution

Explanation:

Download txt
4 0
3 years ago
Other questions:
  • A size of a jumbo candy bar with rectangular shape is l x w x h. Due to rising costs of cocoa, the volume of the candy bar is to
    9·1 answer
  • If you come to a stumbling block and can't think of any more ideas, what could you do? select all that apply 2pts.
    11·2 answers
  • Describe how antipoverty programs can discourage the poor from working. How might you reduce this disincentive? What are the dis
    11·1 answer
  • What encryption method is used by WPA for wireless networks?
    7·1 answer
  • How many responses does a computer expect to receive when it broadcasts an ARP request?why?
    12·1 answer
  • What function would you use to find the mean in a Microsoft excel document ?
    6·2 answers
  • A function ________ contains the statements that make up the function.
    5·1 answer
  • Which of these statements about tags is false?
    12·1 answer
  • Please choose odd one out please tell fast​
    12·1 answer
  • HELP ME PLEASE 41 PTS
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!