NPTEL The Joy Of Computing Using Python Assignment 6 Answers

NPTEL The Joy of Computing using Python Assignment 6 Answers 2022:- In this post, We have provided answers to NPTEL The Joy of Computing using Python Assignment 6. We provided answers here only for reference. Please, do your assignment to your own knowledge.

About The Joy Of Computing Using Python

The Joy Of Computing Using Python is a fun-filled whirlwind tour of 30 hrs, covering everything you need to know to fall in love with the most sought-after skill of the 21st century. This course includes examples of analytics in a wide variety of industries, and we hope that students will learn how you can use analytics in their careers and life. One of the most important aspects of this course is that you, the student, are getting hands-on experience creating analytics models; we, the course team, urge you to participate in the discussion forums and to use all the tools available to you while you are in the course!

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

NPTEL The Joy of Computing using PythonAnswers
Assignment 1Click Here
Assignment 2Click Here
Assignment 3Click Here
Assignment 4Click Here
Assignment 5Click Here
Assignment 6Click Here
Assignment 7Click Here
Assignment 8Click Here
Assignment 9NA
Assignment 10NA
Assignment 11NA
Assignment 12NA

NPTEL The Joy of Computing using Python Assignment 6 Answers 2022 [July – Dec]

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

a. 0
b. 1
c. 2
d. 3

Answer:- c

2. Which of the following is true about recursion?

a. Recursion always performs better than non-recursive code.
b. Recursive code is easier to debug
c. The base case is necessary for recursion.
d. Recursive code can be shorter than non-recursive code.

Answer:- b, c, d

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW

NPTEL The Joy Of Computing Using Python Assignment 6 Answers

3. What will be the output of the following program?

Answer:- b

4. What will be the output of the following program?

Answer:- a

5. What’s the correct code for Binary search?

Answer:- c

6. Which of the following can be used to see the dimension of a NumPy array named ‘arr’?

a. dim(arr)
b. shape(arr)
c. arr.shape
d. arr.shape()

Answer:- c

👇For Week 07 Assignment Answers👇

NPTEL The Joy Of Computing Using Python Assignment 6 Answers

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

a. EJBNPOE
b. FKCORPF
c. HMERTSH
d. HMEQSRH

Answer:- d

8. Select the correct statement
1) print(‘9a’.isalnum()) will return True.
2) ‘9a’ contains both alphabetic and numeric parts.

a. Option 1 is correct, option 2 is correct. Option 2 is the correct explanation for option 1.
b. Option 1 is correct, option 2 is incorrect.
c. Option 1 is correct, option 2 is correct. Option 2 is not the correct explanation for option 1.
d. Option 1 is incorrect, option 2 is incorrect.

Answer:- a

9. What will be the output of the following program?

a. A dictionary with the count of each character in s.
b. A dictionary with the count of each special character in s.
c. A dictionary with the count of letters in s.
d. Error

Answer:- d

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

a. random.choices(L)
b. random.select(L)
c. random.movie(L)
d. random.random(L)

Answer:- a

Programming Assignment Week 6

Q1. Given a list L containing integers, write a program that creates and prints a dictionary ‘d’ containing all the the numbers that occur twice or more in the list as keys and their indexes as values. Both the keys are and their values should be in the same order as given the list.

Code:-

L=[int(i) for i in input().split()]
D=dict()
for i in range(len(L)):
  if L[i] not in D:
    D[L[i]]=[i]  
  else:
    D[L[i]]=D[L[i]]+[i]
p=list(D.keys())[:]
for k in p:
  if len(D[k])<2: 
    D.pop(k)
print(D,end="")

Q2. Romeo and Juliet love each other. Romeo wants to send a message to Juliet and also don’t want anyone to read it without his permission. So he shifted every small letter in the sentence by -2 position and every capital letter by -3 position. (If the letter is c, after shifting to by -2 position it changes to a, and for D new letter will be A).

Code:-

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

Q3. Take a string S as an input and print ‘palindrome’ if string S is a palindrome or ‘not palindrome’ if string S is not a palindrome.

Code:-

S=input().lower()
if list(S)==list(S)[::-1]:
  print('palindrome',end="")
else:
  print('not palindrome',end="")

For More NPTEL Answers:- CLICK HERE

Join Our Telegram:- CLICK HERE

NPTEL The Joy Of Computing Using Python Assignment 6 Answers 2022 [Jan – June]

Q1. The following code will

NPTEL The Joy Of Computing Using Python Assignment 6 Answers
  • Shift every letter in a given word by ‘value’. 
  • Shift every letter in a given word by 1. 
  • Shift every letter in a given word by 26. 
  • Returns the same word.

Answer:- a

The answers will be Uploaded Shortly and it will be notified on Telegram. So Join Now

NPTEL The Joy Of Computing Using Python Assignment 6 Answers

Q2. What will be the output of the following code if the input is ‘The Joy OF Computing’ ?

NPTEL The Joy Of Computing Using Python Assignment 6 Answers
  • Wjg Mqa Rh Fqorwvkpi
  • vjg lqa eh eqorwvkpi
  • Wjg Mqa RI Fqorwvkpi
  • vjg Mqa RI Fqorwvkpi

Answer:- c

Q3. Which of the following is true about recursion?

  • Recursion increases the speed of the program.
  • Recursion decreases the speed of the program.
  • Speed of the program remains the same.
  • Recursion is easier to understand than non-recursive programs.

Answer:- b

Q4. What will be the output of the following program?

NPTEL The Joy Of Computing Using Python Assignment 6 Answers
  • Calculating sum of first n terms.
  • Calculating product of first n terms.
  • Calculating power of first n terms.
  • Calculating sum of last n terms.

Answer:- b

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

Answer:- a

Q6. What is the output of the following program?

Answer:- b

The answers will be Uploaded Shortly and it will be notified on Telegram. So Join Now

NPTEL The Joy Of Computing Using Python Assignment 6 Answers

Q7. What’s the correct code for Binary search?

Answer:- c

Q8.What the following code will do?

Answer:- a

Q9. A programme which is written in a recursive manner cannot be written in a non-recursive manner.

Answer:- b

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

Answer:- d

Programming Assignment week 6

Q1. Aman likes to study about planets. Every night he goes outside and observe some planets with his telescope. Then he guesses the distance of each planet and pen it down. In this process he also pen down his favourite planet position. Given the distance of each planet to be unique you need to return position of Aman’s favourite planet after sorting all the distances.

Code:-

print(sorted(L).index(L[K-1])+1,end="")

Q2. Romeo and Juliet love each other. Romeo wants to send a message to Juliet and also don’t want anyone to read it without his permission. So he shifted every small letter in the sentence by -2 position and every capital letter by -3 position. (If the letter is c, after shifting to by -2 position it changes to a, and for D new letter will be A).
But the letter is too long and Romeo does not have enough time to encrypt his whole letter. Write a program to help Romeo which prints the encrypted message. You can assume there are no special characters except spaces and numeric value

Code:-

Cap=list("ABCDEFGHIJKLMNOPQRSTUVMWXYZ")
Small=list('abcdefghijklmnopqrstuvwxyz')
ans=""
for a in S:
  if a=='a':
    ans+='y'
  elif a=='b':
    ans+='z'
  elif a=='A':
    ans+='X' 
  elif a=='B':
    ans+='Y'
  elif a=='C':
    ans+='Z'
  elif a=='W':
    ans+='T'
  else:
    if a in Cap:
      ans+=Cap[Cap.index(a)-3]
    elif a in Small:
      ans+=Small[Small.index(a)-2]
    else:
      ans+=a
print(ans,end="")

Q3. write a function whole(N) which takes a number N and return the sum of first N whole number. Write the program using recursion.

Code:-

def whole(N):
  return(sum(list(range(N+1))))

The answers will be Uploaded Shortly and it will be notified on Telegram. So Join Now

NPTEL The Joy Of Computing Using Python Assignment 6 Answers

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

NPTEL The Joy of Computing using Python Assignment 6 Answers 2022:- All the Answers are provided here to help the students as a reference, You must submit your assignment at your own knowledge.

1 thought on “NPTEL The Joy Of Computing Using Python Assignment 6 Answers”

Leave a Comment