answer.
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]
1 year 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]1 year 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
How did josh norman and mike keller provide coverage of katrina?
Digiron [165]
<span>They wrote live updates to a blog, so D. The blog was called "Eye of the Storm." It was written as a series of personal musings and photographs of places where the storm hit- first hand accounts of the disaster. They received a journalism award for it.</span>
6 0
1 year ago
Read 2 more answers
Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
ZanzabumX [31]

Answer:

Explanation:

Find attach the solution

6 0
1 year ago
Megan has written the following rough draft for her assignment. Choose the correct way to complete each sentence. Sarah is creat
atroni [7]

Answer:

I. hatching

II. filter

Explanation:

Sarah is creating an image. She wants to achieve tonal effects with parallel lines by varying their densities and distribution patterns. She will use <u>hatching</u> to do this. She also wants to add special effects on the image. Therefore, she will use <u>filters</u>.

Hatching refers to an art technique in which parallel lines are used to shade by drawing them closely together.

Stippling is an art technique used in the making of patterns by using small dots.

Filters is a technique of changing image characteristics. It is used to change the picture characteristics & to add special effects to an image such as the shade, contrast, tone, brightness etc.

We therefore see that, <u>hatching</u> and <u>filter</u> are the correct answers respectively

3 0
2 years ago
B.) Define latency and jitter for service flow in a fixed wireless system.
yuradex [85]
The answer would be between the base station and the subscriber station.
7 0
2 years ago
Which of the following is a true statement about cloud computing?
Veseljchak [2.6K]

Answer:

There are additional security risks associated with using cloud computing over local data storage.                    

Explanation:

Cloud computing: The term "cloud computing" is described as a process through which an individual tends to access and store various programs and data over the internet rather than his or her computers' "hard drive". However, the term "cloud" here refers to a specific metaphor associated with the internet.

Types:

1. Software-as-a-service or SaaS.

2. Platform-as-a-service or PaaS.

3. Infrastructure-as-a-service or IaaS.

In the question above, the very first option is correct as all other options mentioned over here are incorrect because they aren't related to cloud computing.

3 0
1 year ago
Other questions:
  • Match each function with its possible output.
    7·2 answers
  • A slide contains three text boxes and three images that correspond to the text boxes. Which option can you use to display a text
    5·2 answers
  • In 2–3 sentences, describe how you would change the background of a group of cell
    6·2 answers
  • Mr. Cooper would like to customize his Excel software so his students can create an electronic graph in Excel for their lab repo
    6·1 answer
  • Where does an MPLS label go in a PDU?
    13·1 answer
  • A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
    9·1 answer
  • Lin is booting up his computer, and during the boot process, the computer powers down. After several unsuccessful attempts to bo
    12·1 answer
  • "online privacy alliance (opa) is an organization of companies dedicated to protecting online privacy. members of opa agree to c
    15·1 answer
  • Item = "quesadilla"
    7·1 answer
  • 3. Write a program to find the area of a triangle using functions. a. Write a function getData() for user to input the length an
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!