Here a median is the middle element of a sorted list

Assignment Help Basic Computer Science
Reference no: EM13929041

*python 3.1

Write and test the following function:

def median_scores(fv):
    """
    -------------------------------------------------------
    Determines the median of a series of integers in a file.
    Use: m = median_scores(fv)
    -------------------------------------------------------
    Preconditions:
        f - a file variable for a file of integers (file)
    Postconditions:
        returns
        median - the median of the values in the file (float)
    -------------------------------------------------------
    """

Here a median is the middle element of a sorted list if the number of elements is odd, and the average of the two middle elements if the number of elements is even. You may use Python's built-in sort method to sort the contents of the list after they have been read from the file.

Use the file numbers.txt. for testing.

numbers.txt

12
15
32
14
3
234
197
45
241
67
18
91
126
22
111
4
78
21
200
183
9
37
42

Reference no: EM13929041

Questions Cloud

How your personal strengths and weaknesses match : identify how your personal strengths and weaknesses match with the specific situational and follower characteristics you expect to encounter in your current or anticipated leadership role. Explain
Evaluate the use of a distributed database management system : Evaluate the use of a Distributed Database Management System (DDBMS). As with most things, there are numerous advantage and many disadvantages. Evaluate and rank them. What would be good situations to use a DDBMS and why?
Understanding financial statements : Write a 750- to 1,050-word paper evaluating the financial health of a company. Highlight the importance of industry comparisons and trends.
Characteristic shared and inherited from a common ancestor : What term is used to indicate a characteristic that is shared and inherited from a common ancestor?
Here a median is the middle element of a sorted list : Here a median is the middle element of a sorted list if the number of elements is odd, and the average of the two middle elements if the number of elements is even. You may use Python's built-in sort method to sort the contents of the list after they..
String formed from the letters of a string : A mirror has the following pattern: LmR where L is a (possibly empty) string formed from the letters of a string, and R is the reverse of the string L. m is an pivot string whose characters are not in L or R. For example, the following strings have t..
How communication involved in carrying out these strategies : Identify and analyze three strategies you feel are critical to for leaders to apply when facilitating collaborative sessions. How is communication involved in carrying out these strategies?
How cloud based office productivity software is different : Remember to state business problem, articulate the current setup, explain how cloud based office productivity software is different, and how it benefit the business
Problem regarding the accounting software memo : Your department's accounting software is extremely outdated and you have included the purchase of new software in this year's fiscal budget. You have decided it is time to start looking into purchasing your company's accounting software and have c..

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Write a method to set and retrieve an instructors department

write a method to set and retrieve an instructor's department

  All necessary assumptions needed for the completion

Design database document. This assignment consists of two (2) sections: a project introduction and a design document. You must submit both sections as ONE file for the completion of this assignment. Label each file name according to the section..

  Find a business continuity or disaster recovery

300 words or more in apa format with United States References only Research on the general internet or in the University Library and find a Business Continuity or Disaster Recovery article online relating to records recovery

  Create a worksheet that computes membership costs

Create a worksheet that calculates membership costs for Buff and Tuff Gym. You will create functions that determine costs based on a condition, lookup membership rates and fees, and calculate monthly payments. You will also create functions that ..

  Logical structure of active directory

How would you design the logical structure of Active Directory for the Rough Country Miles of Alaska, and what domain naming structure would you suggest?

  Create a details element that displays the summary

Write an HTML5 element (or elements) to accomplish each of the following tasks: a. Students were asked to rate the food in the cafeteria on a scale of 1 to 10.

  Create implementation plan to analyze options

Boardman plans to hire Smith Systems Consulting to help them analyze their options and to create the implementation plan.

  How effective leader can manage changes for new technology

Write down separate 350-word document which explains how the effective leader can manage changes implementing this new technology might need.

  Design and develop a database

Provide a logical and physical design of the database.

  Describe where to apply continuum mechanics

Mechanics of material modelled as continuum is called Continuum Mechanics. Where can you apply continuum mechanics? Continuum mechanics has been successfully applied to solids.

  Describe an algorithm for a turing machine

Describe an algorithm for a Turing machine which receives the integer n as input and proceeds to write the description of the n-th Turing machine from the standard enumeration on its tape.

  Create incident response policy for development of response

Create the incident response policy which covers the development of incident response team, disaster recovery process and business continuity planning.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd