Programming, Data Structures And Algo Using Python Assignment 1 Answers

Programming, Data Structures And Algorithms Using Python Assignment 1 Answers 2022:- In This article, we have provided the answers of Programming, Data Structures And Algo Using Python Assignment 1 You must submit your assignment to your own knowledge.

Q1. What is the value of f(3456) for the function below?

def f(x):
    d=0
    while x >= 1:
        (x,d) = (x/7,d+1)
    return(d)

Answer:- 5

Q2. What is h(60)-h(45), 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)

Answer:-75

Q3. For what value of n would g(375,n) return 4?

def g(m,n):
    res = 0
    while m >= n:
        (res,m) = (res+1,m/n)
    return(res)

Answer:- 4

Q4. Consider the following function f:

def mys(m):
  if m == 1:
    return(1)
  else:
    return(m+mys(m-1))

Which of the following is correct? 

a. The function always terminates with mys(n) = factorial of n 
b. The function always terminates with mys(n) = 1+2+…+n 
c. The function terminates for positive n with mys(n) = factorial of n 
d. The function terminates for positive n with mys(n) = 1+2+…+n

Answer:- d. The function terminates for positive n with mys(n) = 1+2+…+n

Programming, Data Structures And Algorithms Using Python Assignment 1 Answers 2022:- In This article, we have provided the answers of Programming, Data Structures And Algo Using Python Assignment 1 You must submit your assignment to your own knowledge.

Disclaimer:- We do not claim 100% surety of solutions, these solutions are based on our sole expertise, and by using posting these answers we are simply looking to help students as a reference, so we urge do your assignment on your own.

For More NPTEL Answers:- CLICK HERE

Join Our Telegram:- CLICK HERE

Leave a Comment