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
Mariulka [41]
2 years ago
15

a.Write a Python function sum_1k(M) that returns the sum푠푠= ∑1푘푘푀푀푘푘=1b.Compute s for M = 3 by hand and write

another function test_sum_1k() that calls sum_1k(3) and checks that the answer is correct. When you call the sum_1k(3) function, you will see some messages according to if the test is successful or not.
Computers and Technology
1 answer:
stealth61 [152]2 years ago
8 0

Answer:

def sum_1k(M):

   s = 0

   for k in range(1, M+1):

       s = s + 1.0/k

   return s

def test_sum_1k():

   expected_value = 1.0+1.0/2+1.0/3

   computed_value = sum_1k(3)

   if expected_value == computed_value:

       print("Test is successful")

   else:

       print("Test is NOT successful")

test_sum_1k()

Explanation:

It seems the hidden part is a summation (sigma) notation that goes from 1 to M with 1/k.

- Inside the <em>sum_1k(M)</em>, iterate from 1 to M and calculate-return the sum of the expression.

- Inside the <em>test_sum_1k(),</em> calculate the <em>expected_value,</em> refers to the value that is calculated by hand and <em>computed_value,</em> refers to the value that is the result of the <em>sum_1k(3). </em>Then, compare the values and print the appropriate message

- Call the <em>test_sum_1k()</em> to see the result

You might be interested in
Which of these personal protective equipment items prevents injury from falling objects ?
ankoles [38]

OSHA requires that if you work in an environment in which you're at risk of being hit by something that falls, you must: Secure tools and materials to prevent them from falling on people below. Barricade hazard areas and post warning signs. Use toe boards, screens on guardrails or scaffolds to prevent falling objects.

8 0
2 years ago
Tgif
VMariaS [17]
Science and mathematics. STEM can also be engineering but in John’s case, he’s a METEOROLOGIST WHO DOES THE WEATHER FORECAST and meteorologists is part of a study in science and also mathematics because of measuring the speed of some related computations
6 0
2 years ago
Engineers involved in product design and manufacturing use computer-aided design/computer-aided manufacturing (CAD/CAM) systems,
stepan [7]

Engineers who are involved in product design and manufacture of computer-aided should have enough knowledge in circuit and auto cad electronic design.

<u>Explanation:</u>

He or she should have mother board, voltage in or out extra. Person who develops should enough knowledge on circuit design which capacitor, resistance and voltage and processor capacity.

Each design they have first simulates and tested and result should be recorded. On simulation test success design is made.

There is third party software also available for design the circuit and gives the tested results as report.

6 0
3 years ago
A technician is dispatch to troubleshoot a user's computer.
Margarita [4]

Answer:

All of the above.

Explanation:

Thrashing or drive or disk thrashing occurs when the hard drive is stressed with transferring information between the system memory and virtual machine excessively. In thrashing, there is a large number of processes running in the system and the system memory is too small to handle all processes. Thrashing leads to decreased system performance and hard disk failure.

To stop the impact of thrashing, install more RAM, end unimportant progam processes etc.

5 0
3 years ago
Who benefits from digital technology?
Svetradugi [14.3K]

Answer:

Well, the answer is simple. Everybody!

Explanation:

6 0
2 years ago
Other questions:
  • A(n) _________ is an attempt to learn or make use of information from the system that does not affect system resources.
    13·1 answer
  • What is the best way to protect computer equipment from damage caused by electrical spikes?
    9·2 answers
  • What is the time period of 1st generation of computer ???
    11·1 answer
  • Write a program that accepts three decimal numbers as input and outputs their sums?​
    5·1 answer
  • What is the approximate area of the figure? A. 129 square inches B. 113 square inches C. 110 square inches D. 44 square inches
    15·1 answer
  • Two employees were very different in terms of​ age, gender, and other demographic data but they shared a common love of dogs and
    8·1 answer
  • Adam is an Engineering student but has decided that he does not want to work in that field, but in the Manufacturing career clus
    11·2 answers
  • I have a very quick question. So im applying for Early college and i need some future educational goals and maybe im just thinki
    6·1 answer
  • 31
    10·1 answer
  • Which of the following is NOT a reason we use subprograms?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!