answer.
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]
1 year 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]1 year 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
Which statements describe the advantages of using XML?
lutik1710 [3]
I think the correct answer would be that it facilitates the transport of data. It is a very useful tool in the transport and storage of data. XML, also, uses human language rather than computer language so it can be used easily by new users. 
3 0
2 years ago
Read 2 more answers
Which presenter would most likely benefit from a custom slide show?
PIT_PIT [208]
Which presenter would most likely benefit from a custom slide show?

a teacher who teaches four sessions of the same course
3 0
1 year ago
Read 2 more answers
1⁰=?<br> Is equal to...........
Murrr4er [49]

Answer:

1

Explanation:

Anything to the 0th power is 1. However, 0⁰ is undefined.

5 0
2 years ago
Read 2 more answers
In database software, a record is a
Rzqust [24]

Answer:

In database software a record is a group of related data held within the same structure.

4 0
2 years ago
Please help!! Caleb is working on a simple logic-based program to simulate a game of tic-tac-toe. Which programming language wou
irga5000 [103]

Basic language should do it

4 0
2 years ago
Other questions:
  • In three to four sentences, describe why CEOs (the chief executive officers, that is, the leaders of large companies) make very
    9·1 answer
  • On the Picture Tools Layout tab, you can preview results of the numerous styles, borders, effects, and layouts by _______ comman
    7·2 answers
  • Splunk uses ________ to categorize the type of data being indexed..
    11·2 answers
  • Select the correct answer. Rachel needs to make a presentation on ethics and etiquettes in college. She has about 30 minutes to
    13·1 answer
  • The ____________ is an efficient method to mount, power, and organize electrical motor control, automation, and power distributi
    5·1 answer
  • SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick R
    9·1 answer
  • (Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping o
    10·1 answer
  • You can deal with gaps in an PHP array in all but one of the following ways. Which one is it? a. Use the array_values() function
    14·1 answer
  • For a data structure, such as a stack, who is responsible for throwing an exception if the stack is empty and a pop() is called:
    13·1 answer
  • When authenticating a user's password, the password supplied by the user is authenticated by comparing the ____ of the password
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!