#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

A new printer has recently been installed in the office, but it does not print. What is the first source to check for information about the problem? *

The manufacturer's website
Tech support forums
The OS website
POST card

Answers

Hi hi hi hi hi hi hi hi hi

Which of the following Access objects provides a user-friendly data entry method?
Select one:
a. query
b. table
c. form
d. report

Answers

Answer:

Table

Explanation:

Microsoft Access uses an object called a _____ to enter and organize data.

The answer is table.

An ATM allows a customer to withdraw maximum amount of 500

Answers

Answer:

true

Explanation:

Algorithm:

Print "Enter the initial amount: $"
Get totalAmount

Repeat the following steps until totalAmount <= 0 or the user wants to exit
Get withdrawAmount

if withdrawAmount > 500
Print "You cannot withdraw amount of $500 per day."
otherwise
serviceCharge = 0

if withdrawAmount > 300
Find the serviceCharge as below
serviceCharge = (withdrawAmount - 300) * 0.04

Find the deductions as below
deductions = withdrawAmount + serviceCharge

if deductions > totalAmount
Print "Insufficient funds!"
Print "Allow with a service charge of $25? (Y/N): "
Get choice

if choice == 'y' or choice == 'Y'
Find the totalAmount as below
totalAmount -= (deductions + 25)
Print "Service charges: $" serviceCharge
Print "Additional charge: $25"
Print "Current balance: $" totalAmount
otherwise
Find the totalAmount as below
totalAmount -= deductions
Print "Service charges: $" serviceCharge
Print "Current balance: $" totalAmount

if totalAmount > 0
Print "Continue to withdraw? (Y/ N): "
Get choice;

if choice != 'y' and choice != 'Y'
Print "Current balance: $" totalAmount
Set repeat = false;

if totalAmount <= 0
Print "You should deposit an amount of money."

-------------------------------------------------------------------------------

Complete Program:

#include
#include
using namespace std;

int main()
{
double totalAmount;
double withdrawAmount;
double deductions;
char choice;
bool repeat = true;

cout << "Enter the initial amount: $";
cin >> totalAmount;

while(totalAmount > 0 && repeat)
{
cout << "\nEnter an amount to withdraw: $";
cin >> withdrawAmount;

if(withdrawAmount > 500)
{
cout << "You cannot withdraw amount of $500 per day." << endl;
}
else
{
double serviceCharge = 0;

if(withdrawAmount > 300)
serviceCharge = (withdrawAmount - 300) * 0.04;

deductions = withdrawAmount + serviceCharge;

if(deductions > totalAmount)
{
cout << "Insufficient funds!" << endl;
cout << "Allow with a service charge of $25? (Y/N): ";
cin >> choice;

if(choice == 'y' || choice == 'Y')
{
totalAmount -= (deductions + 25);

cout << "Service charges: $" << serviceCharge << endl;
cout << "Additional charge: $25" << endl;
cout << "Current balance: $" << totalAmount << endl;
}
}
else
{
totalAmount -= deductions;

cout << "Service charges: $" << serviceCharge << endl;
cout << "Current balance: $" << totalAmount << endl;
}
}

if(totalAmount > 0)
{
cout << "\nContinue to withdraw? (Y/ N): ";
cin >> choice;

if(choice != 'y' && choice != 'Y')
{
cout << "Current balance: $" << totalAmount << endl;
repeat = false;
}
}
}

if(totalAmount <= 0)
cout << "You should deposit an amount of money." << endl;

cout << endl;
system("pause");
return 0;
}

Which of the following is an example of a long-term goal?Developing a lifetime savings plan

Answers

Answer:

Retirement fund/plan ?

Explanation:

10. Question
What are the drawbacks of purchasing something online? Check all that apply.

Answers

Explanation:

1) the quality of purchased good may be low

2) there might me fraud and cheaters

3) it might be risky

4) we may not get our orders on time

There are many drawbacks of purchasing online, some of them are as follows,

Chance of pirated item in place of genuine product.Chances of fraud during digital purchase and transaction.Product not deliver on time as expected.Not getting chance to feel the product before purchase.

These are some of the drawbacks of purchasing something online.

Learn more: https://brainly.com/question/24504878

how do you format a cd or a DVD ​

Answers

No. The DVD format can't be read by a CD.

How does Accenture view automation?

Answers

Answer:

The description of the given question is summarized below.

Explanation:

These organizations retrained, retooled, and empowered our employees amongst all organization's internal management operating areas throughout order to create an increased automation attitude.Accenture's Innovative Software department was indeed adopting a concept called Human Plus technology, which includes this type of training.

Create union floatingPoint with members float f, double d and long double x. Write a program that inputs values of type float, double and long double and stores the values in union variables of type union floatingPoint. Each union variable should be printed as a float, a double and a long double. Do the values always print correcly? Note The long double result will vary depending on the system (Windows, Linux, MAC) you use. So do not be concern if you are not getting the correct answer. Input must be same for all cases for comparison Enter data for type float:234.567 Breakdown of the element in the union float 234.567001 double 0.00000O long double 0.G0OO00 Breaklo n 1n heX float e000000O double 436a9127 long double 22fde0 Enter data for type double :234.567 Breakdown of the element in the union float -788598326743269380.00OGOO double 234.567000 long double 0.G00000 Breakolon 1n heX float 0 double dd2f1aa0 long double 22fde0 Enter data for type long double:

Answers

Answer:

Here the code is given as follows,

#include <stdio.h>

#include <stdlib.h>

union floatingPoint {

float floatNum;

double doubleNum;

long double longDoubleNum;

};

int main() {

union floatingPoint f;

printf("Enter data for type float: ");

scanf("%f", &f.floatNum);

printf("\nfloat %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type double: ");

scanf("%lf", &f.doubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type long double: ");

scanf("%Lf", &f.longDoubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

return 0;

}

Write a program that prompts the user to enter a positive integer and displays all its smallest factors in decreasing order.

Answers

Answer:

<fact>[ZRjKt9sw6V(gh6E)ehNM3]<zip>

Explanation:

why SSTF disk scheduling is not practically feasible?​

Answers

Answer:

There is a lack of predictability because of the high variance of response time. Additionally, SSTF may cause starvation of some requests. Starvation is possible for some requests as it favors easy to reach requests and ignores the far-away processes.

SSTF disk scheduling is not practically feasible because it makes an external call and is forced to wait for I/O to complete, thereby giving up its first-place position.

What is SSTF disk scheduling?

Shortest Seek Time First (SSTF) is a disc scheduling algorithm that is abbreviated as SSTF. Before moving the head away to service other requests, it selects the request that is closest to the current head location.

Because of the high variance in response time, there is a lack of predictability. Furthermore, SSTF may cause some requests to be denied. Some requests may experience starvation because the system prioritizes nearby requests and overlooks distant operations.

Therefore, because it makes an external call and is obliged to wait for I/O to complete, SSTF disc scheduling is not viable because it loses its first-place status.

To learn more about SSTF disk scheduling, refer to the link:

https://brainly.com/question/23552555

#SPJ2

employees information system source code ..please ​

Answers

Answer:

def greetuser(username)

Sergio has been asked to make a set of data that was once restricted now available to any users. What data type will Sergio apply to this set of data

Answers

The data type Sergio will apply to this set of data that was once restricted to become available to all users is: Public.

A database can be defined as a structured or organized collection of data that are stored on a computer system and usually accessed electronically.

A data type refers to the content of both structured and unstructured data while organizing them into categories based on specific criteria, especially for access or usage, easy retrieval, sorting, and storage by users.

In Computer and technology, the three (3) main data type with respect to restrictions on its access or usage are:

PrivateProtectedPublic

A public data is typically made up of variables that are visible and accessible to all classes or users.

In conclusion, Sergio should make the data a public data, in order to make them available to all users.

Read more: https://brainly.com/question/13889633

Using Java:
Background
Markdownis a formatting syntax used by many documents (these instructions, for example!) because of it's plain-text simplicity and it's ability to be translated directly into HTML.
Task
Let's write a simple markdown parser function that will take in a single line of markdown and be translated into the appropriate HTML. To keep it simple, we'll support only one feature of markdown in atx syntax: headers.
Headers are designated by (1-6) hashes followed by a space, followed by text. The number of hashes determines the header level of the HTML output.
Examples
# Header will become Header
## Header will become

Header


###### Header will become Header
Additional Rules
Header content should only come after the initial hashtag(s) plus a space character.
Invalid headers should just be returned as the markdown that was recieved, no translation necessary.
Spaces before and after both the header content and the hashtag(s) should be ignored in the resulting output.

Answers

what’s the question ? What are you suppose to do

The tax calculator program of the case study outputs a floating-point number that might show more than two digits of precision. Use the round function to modify the program to display at most two digits of precision in the output number.

Answers

Answer:

Explanation:

The following code is written in Python. The tax calculator program was not provided, therefore I created a tax calculator that takes in the total price as an input and adds a 7% tax to it. Then it uses the round() function to make sure that the total is outputted as a decimal with two decimal digits at most.

def taxCalculator(price):

   total = price * 1.07

   formattedTotal = round(total, 2)

   return formattedTotal

A trace table is used for

Answers

Answer:

Trace tables are used to allow programmers to trace the value of variables as each line of code is executed.

Explanation:

The values of the variables are displayed in a table and assist the programmer in identifying any potential errors.

Answer:

Trace tables can enable a programmer to trace the values of variables as each line is executed/processed/ran through the program. And yes, can aid programmers to identify potential errors in the code.

Explanation:

Chất xơ có nhiều trong thực phẩm nào?

Answers

Answer: rau củ quả đều có lượng chất xơ nhiều hơn so với các loại thực phẩn khác

Explanation:

What unit of measurement is used for DIMM read and write times?​

Answers

Answer:

Nanosecond

Explanation:

Nanosecond is used for measuring DIMM read and write times.

Write a method, including the method header, that will receive an array of integers and will return the average of all the integers. Be sure to use the return statement as the last statement in the method. A method that receives an array as a parameter should define the data type and the name of the array with brackets, but not indicate the size of the array in the parameter. A method that returns the average value should have double as the return type, and not void. For example: public static returnType methodName(dataType arrayName[]) 3 The array being passed as a parameter to the method will have 10 integer numbers, ranging from 1 to 50. The average, avgNum, should be both printed in the method, and then returned by the method. To print a double with 2 decimal points precision, so use the following code to format the output: System.out.printf("The average of all 10 numbers is %.2f\n", avgNum);

Answers

Answer:

The method is as follows:

public static double average(int [] arrs){

    double sum = 0,avgNum;

    for(int i = 0;i<arrs.length;i++){

        sum+=arrs[i];

    }

    avgNum = sum/arrs.length;

    System.out.printf("The average of all numbers is %.2f\n", avgNum);

    return avgNum;

}

Explanation:

This defines the method

public static double average(int [] arrs){

This declares sum and avgNum as double; sum is then initialized to 0

    double sum = 0,avgNum;

This iterates through the array

    for(int i = 0;i<arrs.length;i++){

This adds up the array elements

        sum+=arrs[i];     }

This calculates the average

    avgNum = sum/arrs.length;

This prints the average to 2 decimal places

    System.out.printf("The average of all numbers is %.2f\n",

avgNum);

This returns the average to main

    return avgNum; }

slide transition can be defined as ____ of one slide after another​

Answers

Answer:

visual effect

Explanation:

A slide transition is the visual effect that occurs when you move from one slide to the next during a presentation. You can control the speed, add sound, and customize the look of transition effects.

hi, solution, help me please.​

Answers

Answer:

5hujjibjjjjjnNkzkskskwjejekekdkdkeeioee9

Answer:

is it infinity ? let me know

Compare and contrast the android and windows operating systems

Answers

The main difference between Windows and OS X is the computer you can use it with. OS X is exclusively for Apple computers, commonly known as Macs, while Windows is basically for any personal computer from any company.

Question # 9
Multiple Choice
Which option best describes open source software?


a type of software that can be freely used and modified

a type of software that works well with almost all applications and drivers


a type of software used to sync up to Windows


a type of software used to bundle products together

Answers

Answer:

the first option is the best description for an OSS

you get a call from a customer who says she can't access your site with her username and password. both are case-sensitive and you have verified she is entering what she remembers to be her user and password correctly. what should you do to resolve this problem?

a. have the customer clear her browser history and retry

b. look up her username and password, and inform her of the correct information over the phone

c. have the user reboot her system and attempt to enter her password again

d. reset the password and have her check her email account to verify she has the information

Answers

Answer:

answer would be D. I do customer service and would never give information over the phone always give a solution

In order to resolve this problem correctly, you should: D. reset the password and have her check her email account to verify she has the information.

Cybersecurity can be defined as a group of preventive practice that are adopted for the protection of computers, software applications (programs), servers, networks, and data from unauthorized access, attack, potential theft, or damage, through the use of the following;

Processes.A body of technology.Policies.Network engineers.Frameworks.

For web assistance, the security standard and policy which must be adopted to enhance data integrity, secure (protect) data and mitigate any unauthorized access or usage of a user's sensitive information such as username and password, by a hacker, is to ensure the information is shared discreetly with the user but not over the phone (call).

In this context, the most appropriate thing to do would be resetting the password and have the customer check her email account to verify she has the information.

Read more: https://brainly.com/question/24112967

Feiya has several computing devices around the home that are connected to the Internet:
A smart home assistant (connected via wireless)
A laptop computer (connected via wireless)
A desktop computer (connected via Ethernet)
Which of her devices use the Internet Protocol (IP) when sending data through the Internet?

Answers

Answer:

roaming

bluetooth

Explanation:

its right

The device that use the Internet Protocol (IP) when sending data through the Internet is every device she is using.

What is internet protocol?

The Internet Protocol (IP) is a protocol, or set of rules, that is used to route and address data packets so that they can travel across networks and arrive at their intended destination.

Data traveling across the Internet is split up into smaller slices known as packets.

Essentially, it enables linked gadgets to interact with one another despite differences in internal processes, structure, or design.

Network protocols enable easy communication with people all over the world and thus play an important role in modern digital communications.

The Internet can be accessed by a wide range of computing devices. To send data over the Internet, all devices must use the Internet Protocol.

Thus, all the given device will use the Internet Protocol (IP) when sending data through the Internet.

For more details regarding internet protocol, visit:

https://brainly.com/question/27581708

#SPJ2

match the following. dont answer if you dont know please.

Answers

Answer:

instructions= command

the background screen on a computer= desktop

an organized system= folder

list of commands= GUI

performing more then 1 task= multi tasking

an object that contains multiple files= dictionary

graphical user inference= menu

Explanation:

hope this help :)

In the welding operations of a bicycle manufacturer, a bike frame has a long flow time. The set up for the bike frame is a 7 hour long operation. After the setup, the processing takes 6 hour(s). Finally, the bike frame waits in a storage space for 7 hours before sold. Determine the value-added percentage of the flow time for this bike frame. Round your answer to the nearest whole number for percentage and do NOT include the "%" sign in the answer. For example, if your answer is 17.7%, please answer 18. If your answer is 17.4%, please answer 17. No "%" sign. No letter. No symbols. No explanation. Just an integer number.

Answers

Answer:

Bike Frame Flow Time

The value-added percentage of the flow time for this bike frame is:

= 46.

Explanation:

a) Data and Calculations:

Bike Frame Flow Time:

Setup time = 7 hours

Processing time = 6 hours

Storage time = 7 hours

Flow time of the bike frame = 13 hours (7 + 6)

Value-added percentage of the flow time for this bike frame = 6/13 * 100

= 46%

b) Flow time represents the amount of time a bicycle frame spends in the manufacturing process from setup to end.  It is called the total processing time. Unless there is one path through the process, the flow time equals the length of the longest process path.  The storage time is not included in the flow time since it is not a manufacturing process.

Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string, hours: integer) Enrollment(sid: integer, cid: integer, grade: real) Write a relational algebra expression that satisfies this query? Find the distinct names of all students that take at least three courses and major in "Philosophy".

Answers

Solution :

Here, we need to perform JOIN operation of the students and registration.

Use NATURAL JOIN operator [tex]\Join[/tex] and so no need to specify Join condition.

Also we need to selection operator tp select only those course whose major in "philosophy".

Finally we projection operator π to project only distinct students name who took at least three courses.

[tex]$\pi [\sigma_{\text{student's nam}e} [ \sigma(\text{three courses}) \Join \text{"Philosophy"}]]$[/tex]

Journalize the following transactions using the direct write-off method of accounting for uncollectible receivables.

April. 1 Sold merchandise on account to Jim Dobbs, $7,200. The cost of goods sold is $5,400.
June 10 Received payment for one-third of the receivable from Jim Dobbs and wrote off the remainder.
Oct. 11 Reinstated the account of Jim Dobbs and received cash in full payment.

Answers

The journal entry for the transactions will be:

1st April

Debit Account receivables $7200

Credit Sales $7200

(To record sales)

Debit Cost of goods sold $5400

Credit Inventory $5400

(To record cost of goods sold)

10th June

Debit Cash $2400

Credit Account receivable $2400

(To record cash received from customer)

Debit Allowance for uncollectible items $4800

Credit Account receivable $4800

(To record write-off)

11th October

Debit Account receivable $4800

Credit Allowance for uncollectible items $4800

( To record reinstatement of account)

Debit Cash $4800

Credit Account receivable $4800

( To record full cash gotten from customer)

The account receivable on 10th June was calculated as:

= (1/3 × $7200) = $2400

Learn more about journal entry on:

https://brainly.com/question/8913038

why do you think mobile devices have CPUs that are less powerful than those in a larger desktop computer?

Answers

Mobile CPUs are found in laptops and are often slower than their desktop counterparts because they have to be more power-efficient and generate less heat. High power consumption and high heat generation can be a problem for a battery-powered laptop with a relatively small chassis

Mobile devices have CPUs that are less powerful than those in a larger desktop computer needs power as well as the device memory that was needed is not present.

What is CPU?

The central processing unit also known as CPU is an important part of the computer as it posses the part where the basic functions like taking actions, input or ouput etc. This all process needs high power and battery as well as storage.

For a battery excessive electricity utilization and significant temperature rise can just be problems. The CPU of a device cannot be powered at higher, continuous levels using such a little battery.

As a result, the most recent cellphone cannot compete with the performance of a top-tier desktop computer. the processor as well as the battery is needed for a CPU that can not be in mobiles.

Learn more about CPUs, here:

https://brainly.com/question/16254036

#SPJ2

Which type of research source lets a technical writer observe how a product works?

Answers

Answer:

Research to Support Your Technical Communication

As a buyer for a clothing retailer, for example, you might need to conduct research to help you determine whether a new line of products would be successful in your store. As a civil engineer, you might need to perform research to determine whether to replace your company's current surveying equipment with 3D-equipped stations. And as a pharmacist, you might need to research whether a prescribed medication might have a harmful interaction with another medication a patient is already taking

Explanation:

Hope it helps

Please mark as brainliest

Other Questions
an expression that is equivalent to 10x - 8 +0.5(2x - 3)?- Katie earns 15$ each hour. Round to total time katie worked to the nearest hour and estimate her pay by using mulitplacation Find the value of x in the isosceles triangle shown below Brainlyest question! 17 points! Plz Help...Math.................. CAN SOMEONE HELP ME PLEASE ASAP!? There is a bell at the top of a tower that is 45 m high. The bell weighs 15 kg. The bell has energy. Calculate it. You need 12 dozen cookies for a bake sale. The original recipe makes 48 cookies (4 dozen). How much of each ingredient will you need?To make a mixed number, type the whole number, then a space, then the fraction part. Example: Two and one-fourth would be 2 1/4. Only type whole numbers, fractions or mixed numbers in the boxes below (NO DECIMALS). If it does not exactly match the answer I typed in, it will be marked incorrect. Use the / key by the right-side shift button as the fraction bar.Ingredients Original Recipe Your AmountAll purpose flour 214 cups cupsBaking Soda 1 teaspoon teaspoonSalt 12 teaspoon teaspoonButter, softened 1 cup cupGranulated sugar 34 cup cupBrown Sugar 34 cup cupEgg(s) 1 Vanilla 1 teaspoon teaspoonSemisweet Chocolate Chips 2 cups cupsWhat is the constant of proportionality for this situation? Dom mowed 2/5 of his lawn. Maddy mowed 1/4 of it. who mowed most. how much more needs to be mowed 3-(-5)=3+?Not sure what this was A vector consists both? brainlist please solve this A and \angle BB are vertical angles. If m\angle A=(2x-10)^{\circ}A=(2x10) and m\angle B=(x+8)^{\circ}B=(x+8) , then find the measure of \angle AA. A server finds a full napki-lined basket of dinner rolls on a table after a costumer has left the establishment. According to the FDA food code, what should the server do with the rolls and napkins Find the circumference of a circle with a radius of 3/4 km 11,046 as a decimal In a computer-controlled greenhouse, a temperature sensor and a window motor are connected to the computer. If the temperature rises above 23, the windows are opened. Draw a flowchart to describe this system. Which sentence is correct? A. -4 > 3 B. -4< -6 C. -4 > -7 D. -5 > -4 A room has a rectangular floor 5.5 m long and 4.5 m wide. The room is 2.5 m in height.A. What is the area of wall space in the room?B. How much paint is required to paint thewalls with two coats if one litre of paintcan cover 11.25 m?? whant is the difference between from lines and conyour lines