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

  What types of threats does the tool mitigate?

At work, keeping your data safe and your computers up and running is your primary concern. What can employees do to protect against intrusion and attacks?

  Construct and describe a tree

Construct and describe a tree that indicates the following: A college president has 2 employees who answer directly to him or her, namely a vice president and provost. The vice president and provost each have an administrative assistant.

  Write a mobile app

Write a mobile app (using TouchDevelop) that calculates the sum (which computes e×) of n + 1 terms as

  Is it supporting decision making

1- IS/IT Supporting Decision Making. Be sure to answer each part (20 pts.) a. Provide a detailed, clear explanation of the differences between decision support systems and management information systems.Reflect on ALL you learned about decision s..

  How many books must be sold for this project to break even

(a) How many books must be sold for this project to break even? (b) Suppose the publishers wish to take a total of $40,000 in salary for this project. How many books must be sold to break even, and what is the break-even point, in dollars?

  Create a new table for suppliers contact information

1. Create a new table for Suppliers' contact information and set the primary key and appropriate data types for the fields. The table should at least contain the following information: a. Company name and address  b. Representative's name, pho..

  Is the internet used for advertising

Is the Internet used for advertising and is the Internet used for internal and external information dissemination?

  Use a truth table to determine whether

Use a truth table to determine whether or not the following argument form is valid. You can  justify  your answer by doing the following: indicate which columns represent the premises and which represent the conclusion;

  Compare performance-one-level split-two-level unified cache

Compare the performance (using AMAT) of a one-level split cache and a two-level unified cache system. For the one-level split cache, suppose a hit takes 2 clock cycles.

  Define the term use case

Define the term ‘use case' and explain the various types of actors in a Use Case and Describe with examples ‘encapsulation', ‘information hiding', ‘polymorphism' and ‘data abstraction'.

  Store the quotient in a word-size variable called result

Show how to perform 77 / 3 in the HCS12. Store the quotient in a WORD-size variable called result, and the remainder in a WORD-size variable called remainder.

  Loop control variable is not modified by every iteration

1.Describe the three elements that must be included in order for a loop to perform correctly. What will happen if these statements are not included? Provide examples.

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