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
Levart [38]
3 years ago
13

Write a program that will find the smallest, largest, and average values in a collection of N numbers. Get the value of N before

scanning each value in the collection of N numbers.
Computers and Technology
1 answer:
lara31 [8.8K]3 years ago
7 0

Answer:

Program to this  question can be defined as below:

Program:

Num=[] #defining an empty list

count = int(input("Enter total number in the elements: ")) #insert total element

s=0 # defining variable s

print('Enter elements: ')#message

for i in range(1, count+ 1): #loop to calculte sum

   val = int(input())#defining val to collect values

   s=s+val; # defining variable and add values

   avg=s/count; #calculate avg  

   Num.append(val) #add values in list

print("Smallest number: ",min(Num))#print Smallest number

print("Largest number: ",max(Num))#print Largest number

print("Average number: ",avg)# print Average

Output:

Enter total number in the elements: 3

Enter elements:  

8

7

1

Smallest number:  1

Largest number:  8

Average number:  5.333333333333333

Explanation:

In the above program first, define an empty list and use a loop to insert all elements in the list, inside the list an "s" variable is used, to add all elements. In the list and another variable "avg" is used to calculates its average value.

  • In the next line, python min and max, which is inbuilt method.
  • These methods use the print method that prints its maximum, minimum, and average number.    
You might be interested in
To reposition the legend to the left-hand side of a chart, click the _________ button, point to legend, click the right arrow ic
Leona [35]

Answer:

To reposition the legend to the left-hand side of a chart, click the chart elements button, point to legend, click the right arrow icon, and click left. the

Explanation:

Chart Element button is used to add and remove chart elements. It is located in the Charts Layout group on the Chart tools design tab

6 0
2 years ago
Describe the purpose of working directory and how it can be speed or slow file access
Cloud [144]

Explanation:

The working directory is just a file path on your computer that sets the default location of any files you read. If you want to read a file 'file.txt'.

6 0
2 years ago
Write pseudocode to solve the following problem: You are given an array A[1 . . . n] whose each element is a point of the plane
bixtya [17]

Answer:

Answer explained below

Explanation:

void bubbleSort(int X[], int Y[], int n)

{

   int i, j;

   for (i = 0; i < n-1; i++)      

     

   // Last i elements are already in place

   for (j = 0; j < n-i-1; j++)

       if (X[j] > X[j+1])

{

swap(X[j],X[j+1])

swap(Y[j],Y[j+1]);

}

       if (X[j] == X[j+1]&&Y[j]<Y[j+1])

{

swap(X[j],X[j+1])

swap(Y[j],Y[j+1]);

}

}

Since the above algorithm contains 2 nested loops over n.

So, it is O(n^2)

5 0
3 years ago
Laura is in the middle of making a presentation. On one slide, she includes a heading, three subheadings, and three bullet point
Nat2105 [25]

The first one us d....


6 0
3 years ago
Read 2 more answers
Select all that apply.
Nat2105 [25]

Answer:

  • Inserting headers or footers
  • Inserting a watermark

Explanation:

A Master Page is a page which can be used with the majority of the documents of your paper as a reference. Master pages may have visuals elements, such as headlines, footers, column headings, etc that occur on all publishing pages.

7 0
3 years ago
Other questions:
  • Write the interface (.h file) of a class Counter containing: A data member counter of type int. A data member named counterID of
    13·1 answer
  • __________ refers to excavating the sides of an excavation to form one or a series of horizontal levels or steps, usually with v
    12·2 answers
  • 5. How should you use LinkedIn Answers as a professional?
    8·1 answer
  • What are some tasks for which you can use the VBA Editor? i need help for my computer class.
    5·1 answer
  • What runs horizontally and is identified with numbers?
    12·2 answers
  • Convert 4.5 strides to girth
    10·1 answer
  • 2ND LAST QUESTION
    13·1 answer
  • Please NEED HELP ASAP WILL MARK BRAINLIEST ONLY #8
    8·1 answer
  • What might be some challenges if you’re trying to design a product for someone
    14·2 answers
  • Data will zip through a 5G network much faster than through a 4G network because of the 10-fold difference in _____.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!