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
So wait how do i comment on someone's answer because that would be useful ,,.
LuckyWell [14K]

Answer:

Type right under my comment

Explanation:

Look in comments

5 0
3 years ago
Read 2 more answers
Help me please and thanks
Yuri [45]

Answer:

b

Explanation:

6 0
3 years ago
Consider the steps for debugging. First, you should
SCORPION-xisa [38]

Answer:

run the code to see where the error is

Explanation:

4 0
2 years ago
Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
andreyandreev [35.5K]

Answer:If you need to use arrows in a chart, which feature or menu option of a word processing program would you use?

A.  

Picture

B.  

Shapes

C.  

Clip Art

D.  

SmartArt

E.  

Charts

Explanation:

7 0
3 years ago
Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e.g. words[1] = words[2]) and a temporar
Svetlanka [38]

Answer:

words = ['is', 'NLP', 'fun', '?']

tmp = words[1]

words[1] = words[0]

words[0] = tmp

words[3] = '!'

print(words)

Explanation:

- Create the list

- Assign the new values using <em>tmp</em> variable

- Print the result

Since tuples in Python are unchangeable, you cannot transform the list using tuple assignment.

5 0
3 years ago
Other questions:
  • If you want to place the insertion point in a cell to edit a specific part of its contents, you can
    5·1 answer
  • Which option will automatically update copied data?
    12·2 answers
  • Provide a few examples of how cryptography actually secures data.
    8·1 answer
  • What do you think is the most fascinating aspect of the Internet
    5·2 answers
  • Could someone please help?​
    10·1 answer
  • Second Largest, Second Smallest Write a program second.cpp that takes in a sequence of integers, and prints the second largest n
    15·1 answer
  • Give an idea of a law u would like to create
    5·2 answers
  • Que es una red de datos
    7·2 answers
  • Pls answer i will give 20 points
    7·1 answer
  • Does The ps5 digital have a disc drive even Though ps4 games are not compatible
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!