In this article, answers for NPTEL Joy of Computing Using Python Week 8 Assignment 2025 answers. The answers are provided with proofs, all are solved. If you didn't complete the Week 7 Assignment, the link is below.
Also Read: NPTEL Joy of Computing Using Python Week 7 Assignment 2025
Also, Join us on Telegram 👉 CLICK HERE
NPTEL Joy Of Computing Using Python Week 8 Assignment 2025
In this week 8, the following topics are discussed:
- Tuples - Python Data Structure
- Lottery simulation - profit or loss
- Image Processing - Enhance your image
- Anagrams
- Facebook Sentiment Analysis
Last Date: 19-03-2025
Q1. What will be the output of the following Python code?
tup = ([1,2],[3,4])tup[0].append(5)print(tup) {codeBox}
A. ([1, 2, 5], [3, 4])
B. ([1, 2], [3, 4])
C. ([1, 2], [3, 4, 5])
D. TypeError: Tuple object does not support item assignment
Answer: [ A ] ([1, 2, 5], [3, 4])
Q2. What operations can be performed on tuples?
A. Tuples are appendable
B. We can delete a value from tuples
C. Both (a) and (b)
D. We can count the number of instances of an element
Answer: [ D ] We can count the number of instances of an element
Q3. What will be the output of the following Python code?
t=(1,2,3,4,5)for i in range(-1, -len(t), -1):print(t[i]) {codeBox}
A. 1,2,3,4,5
B. 5,4,3,2,1
C. 5,4,3,2
D. 1,2,3,4
Answer: [ C ] 5,4,3,2
Q4. What will be the output of the following Python code?
word='facebook'new=''for w in word:i=ord(w)j=((( i + 26 ) - 97 ) % 26) +97new = new+chr(j)print(new) {codeBox}
A. facebook
B. gbdfcppl
C. ezbdannj
D. ytvxuhhd
Answer: [ A ] facebook
Q5. When will the program print ”Clap!” ?
print('Enter a letter between a-z')player1=str(input())player2=str(input())while(True):if(ord(player1.lower())+1 == ord(player2.lower())):print('clap')breakelse:player1=str(input())player2=str(input()) {codeBox}
A. When both players enter the same letters.
B. When player 2 enters the next letter after player 1.
C. When player 1 enters the next letter after player 2.
D. It will never clap.
Answer: [ B ] When player 2 enters the next letter after player 1.
Q6. What will be the effect of the following Python code on the graph?
import randomimport matplotlib.pyplot as pltl=[]count =0for i in range(10):guess=random.randint(1, 10)pick = random.randint(1, 10)if (guess!=pick):count+=1l.append(count)else:count-=1l.append(count)plt.plot(l)plt.show() {codeBox}
A. The graph will go up when guess and pick are the same.
B. The graph will go down when guess and pick are the same.
C. The graph will go up when guess and pick are not the same.
D. Both (b) and (c).
Answer: [ D ] Both (b) and (c).
Q7. What is the primary advantage of using tokenization in Natural Language Processing (NLP)?
A. It allows the model to understand entire sentences as a single entity.
B. It splits text into smaller, manageable units, which helps in processing language more effectively.
C. It eliminates the need for syntactical analysis.
D. It improves the grammatical structure of the text.
Answer: [ B ] It splits text into smaller, manageable units, which helps in processing language more effectively.
Q8. What will be the output of the following Python code?
string='hey!there'a=sorted(string)a.reverse()print(a) {CodeBox}
A. [’!’, ’e’, ’e’, ’e’, ’h’, ’h’, ’r’, ’t’, ’y’]
B. [’h’, ’e’, ’y’, ’!’, ’t’, ’h’, ’e’, ’r’, ’e’]
C. [’y’, ’t’, ’r’, ’h’, ’h’, ’e’, ’e’, ’e’, ’!’]
D. None of the above
Answer: [ C ] [’y’, ’t’, ’r’, ’h’, ’h’, ’e’, ’e’, ’e’, ’!’]
Q9. While converting an image into black and white, can it be converted back into a colored image?
A. True
B. False
Answer: [ B ] False
Q10. What will be the output of the following Python code?
def test(word):new_word=''for ch in word:if ch>='a' and ch<='z':temp=ord(ch)temp=temp - 32temp=chr(temp)new_word=new_word+tempreturn new_word {codeBox}
A. Converting lowercase letters into uppercase.
B. Converting uppercase letters into lowercase.
C. Returns the same word.
D. Error.
Answer: [ A ] Converting lowercase letters into uppercase.
Conclusion
All answers are solved before providing to you. Although, if you have an query, ping us through telegram.
Join us on Telegram 👉 CLICK HERE