Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Sorry, you do not have permission to ask a question, You must login to ask a question.

SIKSHAPATH Latest Articles

NPTEL The Joy Of Computing Using Python Assignment 6 Answers Update 2023

NPTEL The Joy Of Computing Using Python Assignment 6 Answers (Week 6)

Q1. Which of the following is true about recursion?

Answer: b. Recursive code can be reused.

c. The base case is necessary for recursion.

d. Recursive code can be shorter than non-recursive code

1000+ students getting help from instant notifications, Join us on telegram.


Q2. If PYTHON is encoded by TCXLSR then DIAMOND will be encoded as?

Answer: d. HMEQSRH


Q3. Let L be a list containing different names of movies. Which statement is correct to select a random movie name from that list L?

Answer: a. random.choices(L)


Q4. In the list L = [4,6,7,4,6,2,1], What is the index of element ‘7’?

Answer: c. 2


Q5. What will be the output of the following code?

import string
def shift(word, value):
letters = string.ascii_lowercase 
new = ''
for i in range(len(word)):
if word[i] in letters:
index= letters.index(word[i]) 
new = new + letters [(index+value)%26]
else:
new = new + word[i]
return new

Answer: a. Shift every letter in a given word by value.


Q6. Library used to import images?

Answer: a. PIL


Q7. Values of CSV files are separated by?

Answer: a. Commas


Q8. what will be the output of the following program?

def recursive(num):
if(num==1):
print(*)
return
if (num%2==0):
print(num)
recursive(num-1)
return
else:
recursive(num-1)
return
recursive(10)

Answer: d.

**********

********

******

****

**

*

Q9. What will happen if we don’t check for a base case in recursion.

Answer: c. The program will enter into an infinite loop.


Q10. Which of the following is true about recursion?

Answer: b. Recursion decreases the speed of the program.


The Joy Of Computing Using Python Week 6 Programming Assignment

Q1.

Program:

N=int(input())
L=[int(i) for i in input().split()]
K=int(input())
print(sorted(L).index(L[K-1])+1,end="")

Q2.

Program:

A=input()
ans=str()
for i in A:
  if i.islower():
    if i=='a':
      ans+='y'
    elif i=='b':
      ans+='z' 
    else:
      ans+=chr(ord(i)-2)
  elif i.isupper():
    if i=='A':
      ans+='X' 
    elif i=='B':
      ans+='Y' 
    elif i=='C':
      ans+='Z'
    else:
      ans+=chr(ord(i)-3)  
  elif i.isspace() or i.isnumeric():
    ans+=i
print(ans,end="")
                  

Q3.

Program:

N=int(input())
print(sum([i for i in range(N+1)]),end="")

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.


Also Available:

Joy of computing using python week 4 answers

Related Posts

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO