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
Does learning swift is hard? more than android?
ladessa [460]
No it is not. it's quite simple when you get the hang of it
4 0
3 years ago
Identify the four basic categories of hardware in a personal computer system
Pie
The four basic categories are the motherboard, the CPU, the graphics card, and the RAM.
Brainliest pls! thx! :)
5 0
3 years ago
Persons who have been given access to an installation can be counted on to be of no threat. true or false? (antiterrorism scenar
aliya0001 [1]
<span>The statement that "Persons who have been given access to an installation can be counted on to be of no threat" is false. If they are not honest enough, they could become the dangerous staff the company could ever had because he or she has access to everything, files, information, etc. That is why, in selecting a person to be trusted with such responsibility, he or she undergoes an intensive training.</span>
4 0
3 years ago
write query for all products reutrn product name with its amounts due, paid, canceled, and refunded, order the result by product
spayn [35]

Answer:

SELECT product_name, amount_due, amount_paid,

              cancelled, amount_refunded

   FROM products

ORDER BY product_name ASC;

Explanation:

SQL (Structured Query Language ) was used above.

The SELECT command is used to list all the variables we want in our output.

The FROM command signifies the location.

ORDER BY command ensures that your result is ordered

ASC means Ascending Order.

; signifies the end of the query.

NOTE: Underscores were used because variables cannot be written with spaces between them

8 0
2 years ago
Qué propiedades del bromato de potasio han hecho que sea el aditivo más usado en la fabricación del pan​
torisob [31]

Answer:

es la capacidad de unir proteínas presentes en la harina

4 0
3 years ago
Other questions:
  • What would be a situation in which you could use an excel chart to present your data
    8·2 answers
  • When you identify the data elements in a new database, you typically subdivide data elements into?
    14·1 answer
  • Create a program to calculate the wage. Assume people are paid double time for hours over 60 a week. Therefore they get paid for
    10·1 answer
  • Which activity does not allow a person to perform any work while at the shop
    10·1 answer
  • What is a computer network?
    5·1 answer
  • Your disaster recovery plan calls for tape backups stored at a different location. The location is a safe deposit box at the loc
    13·1 answer
  • What happens when text is added to grouped objects that is larger than an object ?
    9·2 answers
  • Me Completan Pliiiis
    10·2 answers
  • Which of the following database object hold data?
    13·2 answers
  • What is MVC architecture in relation to developing in web applications? How
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!