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
Write the code to call the function named send_signal. there are no parameters for this function.
nikklg [1K]

<em>*Assuming JavaScript</em>

Answer:

function send_signal() {}

send_signal() // calls the function

Explanation:

3 0
2 years ago
Which of the following protocols support the encryption and decryption of e-mail messages?
Katena32 [7]
It seems that you have missed the necessary options for us to answer this question so I had to look for it. Anyway, here is the answer. The protocol that supports the encryption and decryption of e-mail messages is this: <span>Secure Multipurpose Internet Mail Extensions (S/MIME) and Pretty Good Privacy (PGP). Hope this helps.</span>
7 0
3 years ago
How can you stay safe on the Internet? Check all that apply.
Harlamova29_29 [7]

Answer:

all of the above

Explanation:

7 0
2 years ago
Read 2 more answers
The word software is interchangeable with what word
defon
It could be interchangeable with the word program
4 0
3 years ago
25 POINTS!!!!!!!!!!!!!
Paladinen [302]
A leaking data exhaust
7 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is an example of a problem that could be attributed to poor ergonomics?
    10·1 answer
  • Please help!
    6·2 answers
  • How did mark watney survive the accident
    9·1 answer
  • What type of account provides the same functions as managed service accounts but can be managed across multiple servers as in a
    8·1 answer
  • Write a function that accepts an argument for a persons name. The method should loop through the number of characters in the nam
    7·1 answer
  • What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
    10·2 answers
  • You are working on a ticketing system. A ticket costs $10. The office is running a discount campaign: each group of 5 people is
    5·1 answer
  • What are the different Stape of data processing cycle?​
    8·1 answer
  • FILL IN THE BLANK.
    10·1 answer
  • Describe the five components of a computer
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!