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
MrRissso [65]
3 years ago
7

write a program, using python, to determine the mean, median, and standard deviation of a list of numbers. In addition, count th

e number of duplicate numbers in the code and list any numbers that occur more than once, with the number of times the number occurs. submit a listing of your code, and the results. List = [3, 6, 7, 2, 8, 9, 2, 3, 7, 4, 5, 9, 2, 1, 6, 9, 6]
Computers and Technology
1 answer:
Mekhanik [1.2K]3 years ago
7 0

Answer:

The program to this question can be given as:

Program:

import math   #import packages

import sys

number =  [3, 6, 7, 2, 8, 9, 2, 3, 7, 4, 5, 9, 2, 1, 6, 9, 6]  #define list  

n = len(number)   # taking length of list

print("Sample Data: ",number)  #print list

#find Mean

print("Mean is: ")  #message  

add = sum(number)  # addition of numbers.

mean = add / n  #add divide by total list number.

print(str(mean))  #print mean

number.sort()   #short list by using sort function

#find Median

print("Median is: ")

if n % 2 == 0:        #conditional statement.

   median1 = number[n//2]  

   median2 = number[n//2 - 1]  

   median = (median1 + median2)/2

else:  

   median = number[n//2]  

print(str(median)) #print median

#find Standard deviation.

print("Standard Deviation :")

def SD(number):  #define function SD

   if n <= 1:      #check condition

       return 0.0   #return value.

   mean,SD = average(number), 0.0  

   # find Standard deviation(SD).

   for j in number:

       SD =SD+(float(j)-mean)**2

       #calculate Standard deviation holing in variable SD  

       SD =math.sqrt((SD)/float(n-1))#using math sqrt function.

   return SD  #return value.

def average(av):         #define function average

   n,mean =len(av), 0.0  

   if n <= 1:

       return av[0]   #return value.

   # calculate average

   for I in av:

       mean +=float(i)

       mean /= float(n)

   return mean             #return value.

print(SD(number)) #print value

Output:

Sample Data:  [3, 6, 7, 2, 8, 9, 2, 3, 7, 4, 5, 9, 2, 1, 6, 9, 6]

Mean is:  

5.235294117647059

Median is:  

6

Standard Deviation :

2.140859045465338

Explanation:

In the above python program first, we import packages to perform maths and other functions. Then we declare the list that is number in the list the elements are given in the question. Then we declare variable n in this variable we take the number of elements present in the list and print the list first. In the list, we perform three operations that can be given as:

Mean:  

In the mean operation firstly we define the variable add in this variable we add all elements of the list by using the math sum function then we divide the number by number of elements present in the list. and sore the value in the mean variable and print it.

Median:

In the median section firstly we sort the list by using the sort function. Then we use the conditional statements for calculating median. In the if block first we modules the number by 2 if it gives 0. it calculates first and second median the add-in median .else it will print that number.

Standard Deviation:

In the standard deviation part first, we define two functions that is SD() function and average().In the SD() function we pass the list as the parameter. In this function we use the conditional statement in the if block we call the average() function and use for loop for return all values. In the average() function we calculate the average of the all number and return value. At last, we print all values.

You might be interested in
The following SQL statement contains which type of subquery? SELECT title FROM books WHERE EXISTS (SELECT isbn FROM orderitems W
Rudiy27

Answer:

(a) Correlated.

Explanation:

Correlated subquery :These sub queries reference columns from outer table or uses values from outer query.These sub queries are processed atleast once for every row processed.So because of this reason correlated sub queries can be slow.Since the query in the question also uses value from the outer query so it is a correlated query.

4 0
3 years ago
A personal computer system is composed of the processing unit, graphics board, and keyboard with reliabilities of 0.976, 0.785,
frosja888 [35]

Answer:

The answer to the following question is the option "B".

Explanation:

In computer science, the term Reliability is an attribute for any computer-related element like software or hardware. It consistently acts according to its terms. It has a lengthy process for considering one of three similar properties that must be analyzed when using a computer component. So the answer to this question is option B which is "0.684".

7 0
3 years ago
Which of the following are slide layouts in
hjlf

Answer:

title slide

title and content

blank

picture with caption

Explanation:

Slide layouts contain boxes known as placeholders that bear the contents of a slide. They allow users to format, and position content. Colors and fonts are also available. Text, titles, pictures, video, audio, graphics, etc., can be attached to the placeholders. Layouts are adjustable according to the preferences of the user.

There are also features that the sharing of these layouts with other users. To select a layout to be used, the user goes to Home and chose Layout which then supplies the different options.

5 0
3 years ago
Which type of image is composed of lines, curves, and fills?
Nataliya [291]
<h2>Answer: Vectors</h2>

Explanation:

4 0
3 years ago
elements that have little or no effect on search results include . select all that apply. a. keywords b. stop words c. search op
myrzilka [38]

Elements that have little or no effect on search results include:

b. stop words.

d. capital letters.

<h3>What is a binary search?</h3>

Binary search can be defined as an efficient algorithm that is designed and developed for searching an element (information) from a sorted list of data that are stored on a database, especially by using the run-time complexity of Ο(log n)

<u>Note:</u> n is the total number of elements in a list.

In Computer technology, elements that have little or no effect on search results include he following:

  • Stop words.
  • Capital letters.

However, keywords and search operators are important elements that have a significant effect on search results.

Read more on binary search here: brainly.com/question/24268720

#SPJ1

6 0
2 years ago
Other questions:
  • These commands are established by combatant commanders when authorized by the Secretary of Defense through the Chairman of the J
    5·1 answer
  • In this type of network, data is certain to reach its destination.
    7·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    7·2 answers
  • Janet manages the security of the database servers at the mortgage company where she works. The servers are Windows Server 2016;
    15·1 answer
  • To save and store data separate from a computer, it helps to have an
    15·2 answers
  • Create a jQuery ready listener that updates the options within the element with ID toCurrency such that: The first element is: S
    12·1 answer
  • Jim wants to buy a car, but he’ll probably only need it for a couple of years. He has a short commute to work, so he won’t be pu
    5·1 answer
  • In cell B20, enter a function to calculate the average attendance for 2018
    11·1 answer
  • Can someone help me with this lab assignment? I really do not know what should I do?
    5·1 answer
  • HELP PLEASE!!!! Which development method is best explained in this way: developing a system through repeated cycles and smaller
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!