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
Which of the following terms describes a type of useful and legitimate software that is distributed by a developer where they do
brilliants [131]

Answer:

freeware

Explanation:

a freeware is a software that is available free of charge but is not distributed with the source code.

6 0
3 years ago
Who do we make games for?(single term)
Ket [755]

Answer:

Gamers

Explanation:

5 0
3 years ago
Read 2 more answers
Can you please make a simple python program? I will give you 20 points and branliest if it is good! It must include:
alekssr [168]

Answer:

# Solve the quadratic equation ax**2 + bx + c = 0

# import complex math module

import cmath

a = 1

b = 5

c = 6

# calculate the discriminant

d = (b**2) - (4*a*c)

# find two solutions

sol1 = (-b-cmath.sqrt(d))/(2*a)

sol2 = (-b+cmath.sqrt(d))/(2*a)

print('The solution are {0} and {1}'.format(sol1,sol2))

Hope This Helps!!!

3 0
2 years ago
Read 2 more answers
Explain why cloud computing can be more complex than a traditional approach.
sp2606 [1]

Cloud computing is more complex than traditional approach due to the following reasons.

Explanation:

1.Cost Savings and Total Cost of Ownership. When you move to cloud computing you tend to save money in several ways in comparison to traditional IT, including the reduction of in-house equipment and infrastructure.

2.Dissatisfaction in Traditional IT. Many companies are frustrated with the negatives that come with traditional IT, such as poor data backup, managing and maintaining your own hardware, and lack of disaster recovery options.

3.Time to Value and Ease of Implementation. Since you don’t have to spend time configuring hardware, maintain systems, and patching software, you can invest your resources elsewhere.

4.Access to Emerging Technology. Much like a car, the minute you purchase on-premise hardware and software, it immediately starts to age. You can access the latest and greatest innovations with a cloud provider who has more purchasing power and stays up-to-date with available solutions. Also, as new innovations are released, they become less likely to integrate with legacy solutions that are often inflexible. Instead, cloud-first development is coming to the forefront.

5.Using Hybrid to Optimize your Operations. Some organizations take the use of the cloud even further by using multiple clouds simultaneously, thus giving them even more agility. Workloads are placed where they perform best, and where costs are most efficient.

5 0
3 years ago
Write a regular expression pattern that matches strings representing trains. A single letter stands for each kind of car in a tr
MAVERICK [17]

Answer:

See explaination

Explanation:

import re

def isValidTrain(train):

pattern = r'^E+(((P|PP|PPP|PPPP)D)*(BB)*)*C$'

if re.match(pattern, train):

return True

return False

def checkAndPrintTrain(train):

print("Train", train, "is valid:", isValidTrain(train))

checkAndPrintTrain("EC")

checkAndPrintTrain("EEEPPDBBPDBBBBC")

checkAndPrintTrain("EEBB")

checkAndPrintTrain("EBBBC")

checkAndPrintTrain("EEPPPPPPDBBC")

checkAndPrintTrain("EEPPBBC")

checkAndPrintTrain("EEBBDC")

Sample output

Train EC is valid: True

Train EEEPPDBBPDBBBBC is valid: True

Train EEBB is valid: False

Train EBBBC is valid: False

Train EEPPPPPPDBBC is valid: False

Train EEPPBBC is valid: False

Train EEBBDC is valid: False

6 0
3 years ago
Other questions:
  • Give the difference betewen recursion and interation in C. Sight what are the advantages and their disadvantages?
    7·1 answer
  • 21. What is the set of events that occurs between the moment you turn
    7·1 answer
  • Program 7 - Circle You write ALL the code, then run it - Produce the correct output. Turn in code and screen print of successful
    15·1 answer
  • In a linked chain implementation of a queue, the performance of the enqueue operation
    10·1 answer
  • Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp
    7·1 answer
  • A musical time measurer is a(an)
    10·1 answer
  • When making an assembly of design what command is most.commonly used?
    15·1 answer
  • Write a program that accepts a positive integer N as command-line argument, and outputs True if N is the square of some integer,
    13·1 answer
  • Question # 6
    13·1 answer
  • Explain why you do not need expensive equipment to take pictures or record video?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!