What is h(36)-h(34), given the definition of h below?
def h(n):
s = 0
for i in range(2,n):
if n%i == 0:
s = s+i
return(s)
Answers
Answered by
10
Answer:
Cycibiafjbuchcudxyxufycyxt uc B divyx dtdguf
Answered by
2
The above code will display the output as 36, for the value of "h(36)-h(34)".
Explanation:
- The above defined-function adds the factor value of non prime number n. If the user pass prime number then the above fucntion returns 0 because it will not include the 1 and itself factor of any number.
- If the user pass 36 for the value of n, then the above code will return 54, because the factor of 36 (except 1 and 36) are "2, 3, 4, 6, 9, 12, 18" and the adiition of these number are 54.
- If the user pass 34 for the value of n, then the above code will return 19, because the factor of 34 (except 1 and 34) are "2, 17" and the adiition of these number are 19.
- when the user pass "h(36)-h(34)", then it will returns "54-19", which will be 36.
Learn more:
- Python :https://brainly.in/question/14689905
Similar questions