Test Index

CBSE Class 12 Computer Science 2024 Paper Set 4 Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 23 of 35
Marks: +1, -0
(A) Write the Python statement for each of the following tasks using built-in functions/methods only :
(i) To remove the item whose key is "NISHA" from a dictionary named Students.
For example, if the dictionary Students contains {"ANITA":90, "NISHA":76, "ASHA":92}, then after removal the dictionary should contain {"ANITA":90, "ASHA":92}
(ii) To display the number of occurrences of the substring "is" in a string named message.
For example if the string message contains "This is his book", then the output will be 3.
OR
(B) A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to a list and thereafter delete the last element of the list.
Advertisements
Go to Question: