Test Index
CBSE Class 12 Computer Science 2024 Paper Set 4
© examsnet.com
Question : 21 of 35
Marks:
+1,
-0
(A) Write a user defined function in Python named
For example : Consider the following dictionary
showGrades(S) which takes the dictionary S as an argument. The dictionary, S contains Name:[Eng,Math,Science] as key:value pairs. The function displays the corresponding grade obtained by the students according to the following grading rules :Average of Eng,Math,Science | Grade |
|---|---|
>=90 | A |
<90 but >=60 | B |
<60 | C |
S={"AMIT":[92,86,64],"NAGMA":[65,42,43],"DAVID":[92,90,88]}The output should be :AMIT - BNAGMA - CDAVID - AOR(B) Write a user defined function in Python named
Puzzle(W,N) which takes the argument W as an English word and N as an integer and returns the string where every Nth alphabet of the word W is replaced with an underscore ("_").For example : if W contains the word "TELEVISION" and N is 3, then the function should return the string "TE_EV_SI_N". Likewise for the word "TELEVISION" if N is 4, then the function should return "TEL_VIS_ON".
Go to Question: