Answer to Question #303034 in Python for UGYJ

Question #303034

What is h(41)-h(40), given the definition of h below?

def h(n):
    s = 0
    for i in range(1,n+1):
        if n%i > 0:
           s = s+1
    return(s)







1
Expert's answer
2022-02-27T04:23:53-0500
def h(n):
    s = 0
    for i in range(1,n+1):
        if n%i > 0:
           s = s+1
    return(s)
n=41
print("h(",n,") - h(",n-1,") = ",h(n)-h(n-1))



Python output

h( 41 ) - h( 40 ) = 7

>>> 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS