#Write a function called find_median. find_median #should take as input a string representing a filename. #The file corresponding to that filename will be a list #of integers, one integer per line. find_median should #return the medi

Answers

Answer 1

Answer:

Explanation:

The following is written in Python. It takes in a file, it then reads all of the elements in the file and adds them to a list called myList. Then it sorts the list and uses the elements in that list to calculate the median. Once the median is calculated it returns it to the user. The code has been tested and the output can be seen in the image below.

def find_median(file):

   file = open(file, 'r')

   mylist = []

   for number in file:

       mylist.append(int(number))

   numOfElements = len(mylist)

   mylist.sort()

   print(mylist)

   if numOfElements % 2 == 0:

       m1 = numOfElements / 2

       m2 = (numOfElements / 2) + 1

       m1 = int(m1) - 1

       m2 = int(m2) - 1

       median = (mylist[m1] + mylist[m2]) / 2

   else:

       m = (numOfElements + 1) / 2

       m = int(m) - 1

       median = mylist[m]

   return median

print("Median: " + str(find_median('file1.txt')))

#Write A Function Called Find_median. Find_median #should Take As Input A String Representing A Filename.

Related Questions

What is the importance of using Onedrive in Windows 10 and how knowledge of it will have an impact in today's workplace?

Answers

The importance of one drive in windows 10 is that it helps the user to synchronize files in their computer.

Onedrive is a cloud storage system that is useful for the storage of files in a secured manner. A person can easily access their files whenever they want to.

In todays workplace a knowledge of onedrive has a great impact because

Onedrive offers an unlimited access to files whenever they are neededThe files can be available and accessed from anywhereIt helps with the organization of files in the work place.

One drive allows for this to be done even when offline. When online, there is an automatic synchronization of the made changes.

Read more at https://brainly.com/question/17163678?referrer=searchResults

Windows 10's one drive is useful because it enables users to synchronize information among various computers.Onedrive is indeed a cloud storage solution that can be used to store data in a secure environment.The user gets easy access to their files when their desire.In today's workplace, knowing how to use OneDrive is necessary because it gives unrestricted access to files anytime they're needed.The information can be transferred anywhere at.It assists with the arrangement of files in the workplace.It can be done and if you're not linked to the Network. Once you're online, the modifications you've performed are synchronized immediately.

Learn more:

brainly.com/question/24369537

Let a be an int array and let i and j be two valid indices of a, a pair (i,j) with i a[j]. Design a method that counts the different pairs of indices of a in disarray. For example, the array <1,0,3,2> has two pairs in disarray.

Answers

Answer:

Code:-

#include <iostream>

using namespace std;

int main()

{

   // take array size from user

   int n;

   cout << "Enter array size:";

   cin >> n;

   // Declare array size with user given input

   int a[n];

   

   // take array elements from user & store it in array

   cout << "Enter array elements:";

   for(int i=0 ; i < n ; i++){

       cin >> a[i];

   }

   

   /* ----- Solution Starts ----- */

   // i & j for checking disarray & count is for counting no. of disarray's

   int i=1, j=0, count=0;

   

   for(int k=0; k < n ; k++){

       

       if(a[i] > a[j]){

           // if disarray found then increament count by 1

               count++;

               

               }

               // increament i & j also to check for further disarray's

               i++;

       j++;

       }

       // Print the disarray count

   cout << "Pairs of disarray in given array:" << count;

   

   /* ----- Solution Ends ----- */

   

   return 0;

}

Output:-

Which are the best networking projects for a final year student in college

Answers

Answer:

The best networking project for a final year are Security issues with mobile IP.IP based patients monitoring systems.

what are the functions of language in logic?​

Answers

Answer:

Three basic functions of language: Informative, Expressive, and Directive Language

Informative language. Simply put, informative language can be looked at as though it is either right or wrong, or true or falseExpressive languageDirective language

In order to print multiple worksheets, what needs to happen before printing?

Answers

Answer:

Explanation:

Click the File tab.

Click Print, or press the control p keyboard command.

On the Print screen, select the printer and other settings.

Click Print.

Is IBM 1041, Minicomputer? Yes or no​

Answers

Answer:

No

Explanation:

What is the output of this Python program, if the user types 3 as input?

Answers

0 1 2 will be the output of the function

6. Where all controls are lie
a) Properties b) Toolbox c) Solution Explorer d) Files

Answers

Answer:

I think b is correct answer.

An organization needs to integrate with a third-party cloud application. The organization has 15000 users and does not want to allow the cloud provider to query its LDAP authentication server directly. Which of the following is the BEST way for the organization to integrate with the cloud application?

a. Upload a separate list of users and passwords with a batch import.
b. Distribute hardware tokens to the users for authentication to the cloud
c. Implement SAML with the organization's server acting as the identity provider.
d. Configure a RADIUS federation between the organization and the cloud provider

Answers

Answer:

The BEST way for the organization to integrate with the cloud application is:

c. Implement SAML with the organization's server acting as the identity provider.

Explanation:

Implementing SAML (Security Assertion Markup Language) integrations will provide more security to the organization (identity provider) as users' credentials are exposed to fewer parties.  SAML authenticates the users to the cloud application provider.  SAML enables the organization to pass authorization credentials to the service provider by transferring the users' identities to the service provider.

Arrays are commonly used to store data items. Arrays can be managed in ways that fill, iterate over, add to, and delete items from the array. Why is it useful to store multiple pieces of information?

Answers

Answer:

mark me brainlist

Explanation:

what is the difference between system software and application software

Answers

Explanation:

System software is meant to manage the system resources. It serves as the platform to run application software. Application software helps perform a specific set of functions for which they have been designed. Application software is developed in a high-level language such as Java, C++, .

Explanation:

Hope it's the write answer

1011 0110 10102 = ?16

Answers

Answer:

B6A

Explanation:

I think you want to convert binary to hex.

Hexadecimal or "hex" is a numbering system which uses 16 different numerals. We saw that decimal used ten numerals from 0 to 9. Hex expands on this by adding six more, the capital letters A, B, C, D, E and F.

0...1...2...3...4...5...6...7...8...9...A...B...C...D...E...F

Steps to Convert Binary to Hex

1. Start from the least significant bit (LSB) at the right of the binary number and divide it up into groups of 4 digits. (4 digital bits is called a "nibble").

2.Convert each group of 4 binary digits to its equivalent

hex value .

3.Concatenate the results together, giving the total hex number.

Define a class named Payment that contains an instance variable of type double that stores the amount of the payment and appropriate get and set methods. Also, create a method named paymentDetails that outputs an English sentence to describe the payment amount. Next, define a class named CashPayment that is derived from Payment. This class should redefine the paymentDetails method to indicate that the payment is in cash. Include appropriate constructor(s). Define a class named CreditCardPayment that is derived from Payment. This class should contain instance variables for the name on the card, expiration date, and credit card number. Include appropriate constructor(s). Finally, redefine the paymentDetails method to include all credit card information. Define a class named PaymentTest class that contains the main() method that creates two CashPayment and two CreditCardPayment objects with different values and calls paymentDetails for each. (5 pts)

Answers

Answer:

The code is given below:

class Payment

{

private double amount;  

public Payment( )          

{

   amount = 0;

}

public Payment(double amount)

{

  this.amount = amount;

}

public void setPayment(double amount)

{

    this.amount = amount;

}

public double getPayment( )

{

   return amount;

 }

public void paymentDetails( )

{

   System.out.println("The payment amount is " + amount);

}

}

class CashPayment extends Payment

{

       public CashPayment( )

       {

             super( );

       }

      public CashPayment(double amt)

     {

      super(amt);

      }

     public void paymentDetails( )

    {

     System.out.println("The cash payment amount is "+ getPayment( ));

     }

}

class CreditCardPayment extends Payment

{

       private String name;

       private String expiration;

       private String creditcard;

       public CreditCardPayment()

      {

             super( );

            name = " ";

             expiration = " ";

              creditcard = "";

      }

       public CreditCardPayment(double amt, String name, String expiration, String creditcard)

      {

             super(amt);

             this.name = name;

             this.expiration = expiration;

             this.creditcard = creditcard;

      }

         public void paymentDetails( )

        {

           System.out.println("The credit card payment amount is " + getPayment( ));

           System.out.println("The name on the card is: " + name);

           System.out.println("The expiration date is: " + expiration);

           System.out.println("The credit card number is: " + creditcard);

      }

}

class Question1Payment

{

      public static void main(String[ ] args)

       {

         CashPayment cash1 = new CashPayment(50.5), cash2 = new CashPayment(20.45);

         CreditCardPayment credit1 = new CreditCardPayment(10.5, "Fred", "10/5/2010",

                                                                                                "123456789");

         CreditCardPayment credit2 = new CreditCardPayment(100, "Barney", "11/15/2009",

                                                                                                 "987654321");

         System.out.println("Cash 1 details:");

         cash1.paymentDetails( );

         System.out.println( );

         System.out.println("Cash 2 details:");

         cash2.paymentDetails( );

          System.out.println( );

         System.out.println("Credit 1 details:");

         credit1.paymentDetails( );

         System.out.println( );

         System.out.println("Credit 2 details:");

         credit2.paymentDetails( );

         System.out.println( );

       }

}

Output:

Give examples of applications that access files by each of the following methods:
+ Sequentially.
+ Random.

Answers

Answer:

Explanation:

Usually, applications would have the capability of using either one of these options. But for the sake of the question here are some that usually prefer one method over the other.

Any program that targets an API usually uses Sequential access. This is because API's contain all of the data as objects. Therefore, you need to access that object and sequentially navigate that object to the desired information in order to access the data required.

A music application would have access to an entire folder of music. If the user chooses to set the application to randomly play music from that folder, then the application will use a Random Access method to randomly choose the music file to load every time that a song finishes.

WHICH PROGRAMMING LANGUAGES ARE THE BEST AND COMPATIBLE FOR 3D PRINTERS?

Answers

Answer:

G-code and C++ can be used

Where does change management play a major role in transforming a client
business into a data-driven, intelligent enterprise?

Answers

To manage a modern IT environment characterized by hybrid complexity and exponential data growth — and to make that same IT a driver of growth and innovation for the business — you need to build intelligence into every layer of your infrastructure.

Change management plays a major role in transforming a client  business into a data-driven, intelligent enterprise in: data culture and literacy.

Data culture and literacy refer to all the processes involved in analyzing and understanding data within the framework of an organization.

The employees within such organizations are trained to read and understand data. It becomes a part of the organization's culture.

So data culture and literacy should be used when trying to transform a client  business into a data-driven, intelligent enterprise.

Learn more about data culture here:

https://brainly.com/question/21810261

This method adds newValue to the list at the specified index. If the index is invalid for the list, throw an IndexOutOfBoundsException. Note that the last valid index is the size of the list; this would mean adding to the back of the list. Call any existing methods of LinkedList and LLNode as needed.

Answers

Answer:

i dont know

Explanation:

What is one advantage and disadvantage of designing a support security that might be based on a centralized model, where all sensitive information is stored in one secure place, or a distributed model, where information is spread around in many different places?

Answers


Co-Ordination Difficulty: ...
Waste of Resources: ...
Larger Interests of the Enterprise Neglected: ...
Emergency Decision not Possible: ...
Lack of Qualified Managers: ...
Certain Activities Decentralization not Possible:

A processor’s speed is measured in (a) or gigahertz. The (b) (higher/lower) the hertz, the faster the processing of instructions.
(a)

(b)

Answers

Answer:

(a) gigahertz(b) higher

Explanation:

As,

The processor's speed measures the number of cycles your CPU executes per second, measured in GHz (gigahertz).The higher the processor's hertz a CPU has, the faster it can process instructions.

Answer:

A) Gigahertz.

B) Higher.

Explanation:

i took the test

fill in the blank with the correct response

Answers

Answer:

regenerates

Explanation:

a hub regenerates it's signal bit by bit as it travels down the physical medium

define a computer with its Proper meaning​

Answers

Answer:

computer is defined as a electronic machine which gives us meaningful result as fast as possible

Answer:

As known a computer can be defined as the use of computers to store, retrieve, transmit and manipulate data or information.

How can an IS managers keep up with the endless demand for more software to support new information systems​

Answers

An IS manager can keep up with the endless demand for more software to support new information systems by thinking outside the box.

To think outside the box, the IS manager should try the following strategies:

Use predetermined application components that are operating on low-code or no-code platforms.Use better software-testing practices and tools that spread programming into small sprints.Engage in shift-left testing, which enables software-testing to be done at every phase of the development process.Involve product managers and business users at the beginning of software development, making them to drive innovation that satisfies their requirements.Finally, the IS manager can utilize AI and Machine Learning to speed up the development of required software, thereby enhancing its qualities and capabilities with reduced time and costs.

Thus, the IS manager must realize that there are always solutions to every software problem outside the mainstream box.

Learn more about information systems here: https://brainly.com/question/1521627

How do l write a program which countdown from 10 to 3​

Answers

Answer:

use loop

for(int i =10;i>2; i--)

{

System.out.println(i+"\n")

}

, , and angle x and angle y are both in the first quadrant.

Answers

Answer:

[tex]\tan(x+y) = 3.73[/tex]

Explanation:

The missing part of the question are:

[tex]\sin(x) = \frac{1}{2}[/tex]

[tex]\cos(y) = \frac{\sqrt 2}{2}[/tex]

Required

[tex]\tan(x + y)[/tex]

First, we calculate [tex]\sin(y)[/tex] and [tex]\cos(x)[/tex]

We have:

[tex]\sin^2(x) + \cos^2(x) = 1[/tex]

So:

[tex](1/2)^2 + \cos^2(x) = 1[/tex]

Collect like terms

[tex]\cos^2(x) = 1 - (1/2)^2[/tex]

[tex]\cos^2(x) = 1 - \frac{1}{4}[/tex]

Take LCM

[tex]\cos^2(x) = \frac{4-1}{4}[/tex]

[tex]\cos^2(x) = \frac{3}{4}[/tex]

Square roots of both sides

[tex]\cos(x) = \frac{\sqrt 3}{2}[/tex]

Similarly,

[tex]\sin^2(y) + \cos^2(y) = 1[/tex]

So:

[tex]\sin^2(y)+(\sqrt 2/2)^2 = 1[/tex]

[tex]\sin^2(y)+ (2/4) = 1[/tex]

[tex]\sin^2(y)+1/2 = 1[/tex]

Collect like terms

[tex]\sin^2(y) = 1 - 1/2[/tex]

Take LCM

[tex]\sin^2(y) = \frac{2 -1}{2}[/tex]

[tex]\sin^2(y) = \frac{1}{2}[/tex]

Square roots of both sides

[tex]\sin(y) = \frac{1}{\sqrt2}[/tex]

Rationalize

[tex]\sin(y) = \frac{\sqrt2}{2}[/tex]

So, we have:

[tex]\sin(x) = \frac{1}{2}[/tex]           [tex]\cos(x) = \frac{\sqrt 3}{2}[/tex]

[tex]\cos(y) = \frac{\sqrt 2}{2}[/tex]        [tex]\sin(y) = \frac{\sqrt2}{2}[/tex]

[tex]\tan(x) = \sin(x) \div \cos(x)[/tex]

[tex]\tan(x) = \frac{1}{2} \div \frac{\sqrt 3}{2}[/tex]

Rewrite as:

[tex]\tan(x) = \frac{1}{2} * \frac{2}{\sqrt 3}[/tex]

[tex]\tan(x) = \frac{1}{\sqrt 3}[/tex]

Rationalize

[tex]\tan(x) = \frac{\sqrt 3}{3}[/tex]

Similarly

[tex]\tan(y) = \sin(y) \div \cos(y)[/tex]

[tex]\tan(y) = \frac{\sqrt 2}{2} \div \frac{\sqrt 2}{2}[/tex]

[tex]\tan(y) = 1[/tex]

Lastly,

[tex]\tan(x + y)= \frac{\tan(x) + \tan(y)}{1 - \tan(x) \cdot \tan(y)}[/tex]

[tex]\tan(x + y)= \frac{\frac{\sqrt3}{3} + 1}{1 - \frac{\sqrt3}{3} \cdot 1}[/tex]

[tex]\tan(x + y)= \frac{\frac{\sqrt3}{3} + 1}{1 - \frac{\sqrt3}{3}}[/tex]

Combine fractions

[tex]\tan(x + y)= \frac{\frac{\sqrt3+3}{3}}{\frac{3 - \sqrt3}{3}}[/tex]

Cancel out 3

[tex]\tan(x + y)= \frac{\sqrt3+3}{3 - \sqrt3}[/tex]

Using a calculator

[tex]\tan(x+y) = 3.73[/tex]

will social media lose its relevance?​

Answers

Judging from it's prevalence and popularity, there will be a long way to go until people start to lose interest with expressing themselves online. So no, social media will not lose its relevance, but maybe when technology is dead, then it will.

A sinewave has a period (duration of one cycle) of 645 μs. What is the corresponding frequency of this sinewave, in kHz, expressed to 3 significant figures?


please help me figure this out I am so confused

Answers

The corresponding frequency of this sinewave, in kHz, expressed to 3 significant figures is: 155 kHz.

Given the following data:

Period = 645 μs

Note: μs represents microseconds.

Conversion:

1 μs = [tex]1[/tex] × [tex]10^{-6}[/tex] seconds

645 μs = [tex]645[/tex] × [tex]10^{-6}[/tex] seconds

To find corresponding frequency of this sinewave, in kHz;

Mathematically, the frequency of a waveform is calculated by using the formula;

[tex]Frequency = \frac{1}{Period}[/tex]

Substituting the value into the formula, we have;

[tex]Frequency = \frac{1}{645\; * \;10^{-6}}[/tex]

Frequency = 1550.39 Hz

Next, we would convert the value of frequency in hertz (Hz) to Kilohertz (kHz);

Conversion:

1 hertz = 0.001 kilohertz

1550.3876 hertz = X kilohertz

Cross-multiplying, we have;

X = [tex]0.001[/tex] × [tex]1550.39[/tex]

X = 155039 kHz

To 3 significant figures;

Frequency = 155 kHz

Find more information: https://brainly.com/question/23460034

Mobile computing is growing in importance each and every day, and the IT manager must take that into account. Do some web research and develop a one-page description of the five most important things about HCI of mobile computing that the IT manager should know.

Answers

Answer:

phone grows everyday 82 percent

Explanation:

How to overcome software quality dilemma

Answers

Explanation:

anytime software and business come together there is an inherent conflict between get it done fast and do a good job

explain computer coding in an understandable manner​

Answers

Answer:

Coding is simply how we communicate with computers. Code tells a computer what actions to take, and writing code is like creating a set of instructions

Explanation:

Computer coding empowers kids to not only consume digital media and technology, but to create it. Instead of simply playing videogame or envision what their own website, or app might look like and they'll have the outlet for the expression

A _______ read inputs the first data item from a file. It typically appears immediately before the loop that processes the data from the file and inputs the remaining data from the file.

Answers

Answer:

the answer is priming read

Explanation:

hope it helps u

Other Questions
The relationship between the frequency and wavelength of a wave isa. Directb. Inversec. Cyclicd. No relationship what evidence shows that biological molecules on earth form naturally? Anne deposited $500 in an account that earns 6% simple annual interest. Shelly deposited $500 in an account that earns 6% annual interest compounded annually. They leave the money in the account for 4 years. What is the difference between the two accounts? If (x+2),3x and (4x+1)are in AP find the value of x Thc t, th trng dng cch no xc nh thi gian lao ng x hi cn thit cho 1 loi sn phm differences between regolith and bedrock in 5 points In Act 4, Scene 1 of Romeo and Juliet, what does Juliet bring with her to Friar Laurence's cell? The 1991 Tractor has a horse power of 195, which is five less than four times the horsepower of the Cinderella's carriage. What was the horsepower of the carriage? 100 POINTSMy neighborhood is full of one-way streets. To drive from my house to the grocery store, I have to go 1 block south, then 1 block east, then 5 blocks north, then 2 blocks east. Each block is 1/16 of a mile. How much shorter would my trip be if I could fly like a bird (that is, travel in a straight line)?I FOUND THE distance for non bird which is 9/16. I wanna apply the pythagoreum theorum and draw a straight line to make it a triangle so I can do so but don't know where to place it If there are:6 red marbles10 yellow marbles5 green marblesand 1 blue marbleWhat is the probability of picking 1 red marble and 1 green marble? (Once a marble is chosen it IS put back into the box). (Write your answer in the form of a decimal, round to 2 places). Find the slope when Y2 equals 8Y1 equals 4 X2 equals 6 and X1 equals 7 if 73.87% of South Africa's households use electricity for cooking. what do the remaining 26% use? suggest other three resources write any two pilgrimage sites of province no 1 Which of these statements about photosynthesis is correct?A. Both photosynthesis and respiration require the same amount of energy for metabolic processes, such as synthesis and the breakdown of carbohydrates.B. Photosynthesis releases energy for metabolism, whereas respiration requires energy for the breakdown of carbohydrates.C. Photosynthesis requires energy for the synthesis of carbohydrates, whereas respiration releases energy during the breakdown of carbohydrate Do you like living in the countryside or in the city ? Why ? Create an equation in slope-intercept form for the line that passes through (3, 6) and (6, 10). A cash register contains $10 bills and $50 bills with a total value of $1080.If there are 28 bills total, then how many of each does the register contain? which of the following not a hardware componet1.mouse2.monitor 3.system unit4.projector Jacqueline is a 42-year-old woman who is in her third trimester of pregnancy. Jacqueline has had three other children; their birth weights were 9.0 lbs, 9.5 lbs and 9.3 lbs. Jacqueline is a smoker with high blood pressure, and has gained 75 pounds during the last 4 months. 1. What is your diagnosis? 2. What test can you use to confirm your diagnosis? 3. What is Jacqueline's prognosis? 4. What treatments are available? Which of these figures has rotational symmetry?O A.O B.C.O D.