CBSE Class 11 Computer Science Question 134 of 173

Data Handling — Question 23

Back to all questions
23
Question

Question 18a

Find the errors(s)

name = "HariT"
print (name)  
name[2] = 'R' 
print (name)  

Answer

The line name[2] = 'R' is trying to assign the letter 'R' to the second index of string name but strings are immutable in Python and hence such item assignment for strings is not supported in Python.

Answer