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]
3 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]3 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
Please NEED HELP ASAP WILL MARK BRAINLIEST ONLY #8
ValentinkaMS [17]

Answer:

I think its A

Explanation:

6 0
2 years ago
Help me with this please
Ymorist [56]

Answer:

q1 chees

q2 web and digital continant

Explanation:

because haaa haaa haa dhum

7 0
2 years ago
Some smartphones use ______ text, where you press one key on the keyboard or keypad for each letter in a word, and software on t
Oksanka [162]

Answer:

The answer is "predictive".

Explanation:

The statement lacks some details, which can be answered by the choice of the question:

A. Presumptive .

B. suggestive .

C. interpretive.

D. predictive.

Predictive text is considered to be auto-correct text as well. It is an input technique, which allows people to type words onto a smartphone throughout the text field. It's focused on both the significance of the words and letters in the message, and certain choices were wrong, which can be defined as follows:

  • Option B and Option D both were wrong because it provides the synonyms of the words.
  • In option C It is wrong because it is a text version.

5 0
3 years ago
MODS ONLY answer this, I have something for you. I'm reporting this to make it easier
aliya0001 [1]

Answer:

whyyyyy

have  a good day :)

Explanation:

7 0
3 years ago
Reed Hastings created Netflix. His inspiration came from the fact that he had to pay a sizeable late fee for returning a DVD bey
noname [10]

Answer:

Which statement accurately describes his key to success?

Explanation:

The success in Netflix lies in offering:

1. Entertainment;

2. fun;

3. originality;

4. innovation and

5. happiness.

Netflix learning is:

1. Bet on your content.

2. Brand Personality.

3. Visual universe.

4. Customization

5. Big Data helps Netflix continue to grow and improve customer service.

3 0
3 years ago
Other questions:
  • Describe Ms word environment.​
    14·1 answer
  • Write an examples of Output device, storage devices and inputs device 10 each excluding the common ones​
    5·1 answer
  • Janet manages the security of the database servers at the mortgage company where she works. The servers are Windows Server 2016;
    15·1 answer
  • PLEASE HELP ASAP!!
    11·2 answers
  • Modify an array's elements Write a for loop that iterates from 1 to numberSamples to double any element's value in dataSamples t
    11·1 answer
  • This assignment will again take the form of a compare/contrast essay. You will use the fresco of Christ Teaching the Apostles in
    14·1 answer
  • Why would over-50 executives have a harder time buying into the idea of social media?​
    15·1 answer
  • Queries are questions true or false?
    9·1 answer
  • Would my phone still work if I snapped it in half?
    8·2 answers
  • What is the purpose of quick access toolbar?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!