Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

*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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91601920
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question suppose there are 150 users sharing a

Question : Suppose there are 150 users sharing a communication link. Suppose each user transmits data only 12% of the time. Give the (compact) formula for finding the probability that at most 20 users are transmitting si ...

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

A shipment of 11 televisions sets contains 4 defective sets

A shipment of 11 televisions sets contains 4 defective sets. A hotel purchases 7 of these televisions sets. a: In how many ways can a hotel purchase 7 and receive 2 of the defective sets? b: What is the probability that ...

Question erd assignmentcreate a crows foot erd following

Question: ERD Assignment Create a Crow's foot ERD following the business rules for the ProdCo Company. 1. Each sales representative writes many invoices 2. Each invoice is written by one sales representative 3. Each sale ...

Question recently it has become obvious that people are

Question: Recently it has become obvious that people are storing data where it does not belong and people are accessing files and directories that they should not have access to. Elizabeth Montgomery is in charge of the ...

Suppose you have an object made up of two w-bit integers x

Suppose you have an object made up of two w-bit integers, x and y. Suppose that the hash code for your object is defined by some deterministic function h(x; y) that produces a single w-bit integer. Prove that there exist ...

Recursive greatest common divisor the greatest common

(Recursive Greatest Common Divisor) The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. what is a recursive function gcd that returns the greatest common divisor of x ...

What is the various security architectures which provides

What is the various security architectures. Which provides the best balance between simplicity and security? Justify your answer.

Question 1 your organization has approximately 10 tb of

Question: 1. Your Organization has approximately 10 TB of data, and you need to decide if your organization should have on-site or off-site tape storage. 2. Your organization must be able to easily recover data no older ...

Sometimes when we visit super markets we may share our

Sometimes when we visit super markets, we may share our personal details to get (for example) "Loyalty cards" and other benefits. Do you think sharing such details is a good approach? Give arguments for both cases: "shar ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As