Programming, Data Structures And Algorithms Using Python Week 1 NPTEL Assignment Answers 2025

Need help with this week’s assignment? Get detailed and trusted solutions for Programming, Data Structures And Algorithms Using Python Week 1 NPTEL Assignment Answers. Our expert-curated answers help you solve your assignments faster while deepening your conceptual clarity.

✅ Subject: Programming, Data Structures And Algorithms Using Python (nptel programming, DSA using python answers)
📅 Week: 1
🎯 Session: NPTEL 2025 July-October
🔗 Course Link: Click Here
🔍 Reliability: Verified and expert-reviewed answers
📌 Trusted By: 5000+ Students

For complete and in-depth solutions to all weekly assignments, check out 👉 NPTEL Programming, Data Structures and Algorithms using Python Week 1 Assignment Answers

🚀 Stay ahead in your NPTEL journey with fresh, updated solutions every week!

Programming, Data Structures And Algorithms Using Python Week 1 NPTEL Assignment Answers 2025

1. What is the value of g(728) for the function below?

def g(y):
b = 0
while y >= 3:
(y,b) = (y/3,b+1)
return(b)
Answer : 5

2. What is f(90)-f(89), given the definition of f below?

def f(n):
s = 0
for i in range(2,n):
if n%i == 0 and i%2 == 1:
s = s+1
return(s)
Answer : 5

Looking for programming, DSA using python assignment answers? Explore year-wise assignment answers in one place!

3. Consider the following function h.

def h(n):
s = True
for i in range(1,n+1):
if i*i == n:
s = False
return(s)

The function h(n) given above returns False for a positive number n if and only if:

  • n is an odd number.
  • n is a prime number.
  • n is a perfect square.
  • n is a composite number.
Answer : For Answers Click Here 

4. Consider the following function foo.

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

Which of the following is correct?

  • The function always terminates with foo(n) = factorial of n
  • The function always terminates with foo(n) = n(n+1)/2
  • The function terminates for non­negative n with foo(n) = factorial of n
  • The function terminates for non­negative n with foo(n) = n(n+1)/2
Answer : For Answers Click Here 

NPTEL Programming Data Structures And Algorithms Using Python Week 1 Assignment Answers 2024

Q1. What does f(27182818) return, for the following function definition?

def f(x):
  d=0
  while x > 1:
    (x,d) = (x/2,d+1)
  return(d)
Answer:- 25

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 mys:

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

Which of the following is correct?

The function always terminates with mys(n) = factorial of n
The function always terminates with mys(n) = 1+2+…+n
The function terminates for non-negative n with mys(n) = factorial of n
The function terminates for positive n with mys(n) = factorial of n

Answer:- d