Question: Problem 3 : Below are two functions that calculates the sum of the first n integers using python. In other words, ? ? ( n
Problem : Below are two functions that calculates the sum of the first
integers using python. In other words, dots
def operatornamesumn
if nmathrm :
return
else:
return n sumn
def sumn:
return nn
Answer the questions below:
a Choose different numbers for Verify that sum equals sum for
these numbers.
b Which of these two functions do you think is generally more efficient for
Why do you think this is so
c Do you think sum or sum is more efficient? Why?
A What happens if you call sum
e Let's define the open sentance:
i What is the smallest ninN such that is true? Let's label this
case where is this smallest such number. In other words,
what is
true statements?
iii. Is the following statement true or false:
iv Assume you could use to validate whether sumn is correct
for large number of How would you rewrite the open statement
v Can you rewrite sumn so that it calls sum
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
