1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
damaskus [11]
2 years ago
14

Write a program that computes and prints the average of the numbers in a text file. You should make use of two higher-order func

tions to simplify the design.
Computers and Technology
1 answer:
lara [203]2 years ago
4 0

Answer:import functools

# open your file

file = open("integers.txt", 'r')

file = file.read()

# put numbers into a list

file = file.split()

# convert list into integers

file = list(map(int, file))

# use lambda function to get average.

print(functools.reduce(lambda x, y: x+y / len(file), file, 0))

Explanation:

You might be interested in
Cache memory is a special group of very fast memory circuitry located on or close to the CPU that is used to speed up processing
antoniya [11.8K]

Answer:

TRUE

Explanation:

Cache memory is a computer component that help to retrieve data from the computer's memory by acting as a temporary storage area where the computer's processor can retrieve data easily. The temporary storage area is known as cache and is more readily available to the processor than the computer's main memory source.

Although Cache memory is a smaller type of a computer memory that provides high-speed data access to a processor and stores which frequently used computer programs, applications and data.

Cache memory is used to reduce the average time to access data from the Main memory and they stores data so that future requests for that data can be served faster.

5 0
3 years ago
2) What is the value stored in the variable z by the statements below?
Dmitriy789 [7]

Answer:

7

Explanation:

Because the q.length is a inbuilt function in the programming which used to get the length of the array. In the array, there are 7 values are store. Therefore, the size 7 store in the variable z.

For example:

int[] array={1,2};

int x = array.length;

the answer of above code is 2, because the elements present in the array is 2.

 

5 0
2 years ago
When you move into a new home or apartment, the first thing on your checklist should be to have the ____________ changed. (5 Let
Lynna [10]

Answer:

When you move into a new home or apartment, the first thing on your checklist should be to have the <u>locks</u> changed

Explanation:

Changing the locks

Given that the way the previous owners of the new home or apartment made use of the locks and the keys are usually not completely known to the new owners, one may never know all those that have a key or a means to gain access into the apartment or home. Therefore, in order to guarantee proper security, it is a good practice to have as one of the first thing on the checklist, the changing of the locks of the entrance doors and windows of the new home or apartment.

5 0
2 years ago
Which visual aid should Emil use to compare and contrast the political systems in three countries?
BaLLatris [955]
A vent diagram. It helps to outline the differences and the similarities between the three countries
5 0
3 years ago
The arrival of personal computer technology gave rise to client server networks that replaced traditional mainframe and minicomp
zvonat [6]

Answer:

The replacement of traditional mainframe and minicomputers  is a prime example of technological paradigm shift.

Explanation:

As the change of traditional mainframe and minicomputers to personal computers is due to the technological advancements, which led to creation of client server networks. This paradigm shift is the technological shift as the main reason for the shift is due to the technical advancement and enhancement.

8 0
3 years ago
Other questions:
  • A user has a new web email account and asks a technician for help with setting up email on a tablet. The user would like for the
    11·1 answer
  • A ___ is the basic collective unit of data in a computer.
    12·1 answer
  • // This pseudocode is intended to display // employee net pay values. All employees have a standard // $45 deduction from their
    12·1 answer
  • When should you talk to an adult you trust
    12·1 answer
  • What is a disadvantage of shopping online?A.Harder to compare prices than in storesB.A higher risk of financial data theftC.More
    6·2 answers
  • Karin realized that a song takes up a lot more space on her computer than the lyrics of the song typed out in ms word document .
    12·1 answer
  • after entering backstage view, and clicking account settings, what are the steps for creating a delegate for an outlook folder
    6·1 answer
  • Look at the picture ​
    13·2 answers
  • Which statement is true about encoding in Python?
    7·1 answer
  • A company is looking for an employee to assign passwords to all of its
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!