The record of a student (Name, Roll No.,Marks in five subjects and percentage of marks) is stored in the following list:
stRecord = ['Raman','A-36',[56,98,99,72,69], 78.8]
Write Python statements to retrieve the following
information from the list stRecord.
a) Percentage of the student
b) Marks in the fifth subject
c) Maximum marks of the student
d) Roll no. of the student
e) Change the name of the student from
‘Raman’ to ‘Raghav’
Answers
Answer:
List Name Name Roll No. Marks in 5 Subjects Percentage
stRecord Raman A-36 [56, 98, 99, 72, 69] 78.8
Index 0 1 2
[0, 1, 2, 3, 4]
index of the list at index 2
3
Explanation:
Here, we can see that the 'name' is stored at index 0, 'roll no' at index 1, 'marks of the 5 subjects' is stored at index 2 in a list which contains 5 elements, and 'percentage' at index 3
Percentage: stRecord[3]
Marks in 5th Subject: stRecord[2][4]
Maximum Marks of the Student: max(stRecord[2])
Roll no. of the student: stRecord[1]
Change the name from Raman to Raghav: stRecord[0] = "Raghav"
Answer:
List Name Name Roll No. Marks in 5 Subjects Percentage
stRecord Raman A-36 [56, 98, 99, 72, 69] 78.8
Index 0 1 2
[0, 1, 2, 3, 4]
index of the list at index 2
3
Explanation:
Here, we can see that the 'name' is stored at index 0, 'roll no' at index 1, 'marks of the 5 subjects' is stored at index 2 in a list which contains 5 elements, and 'percentage' at index 3
Percentage: stRecord[3]
Marks in 5th Subject: stRecord[2][4]
Maximum Marks of the Student: max(stRecord[2])
Roll no. of the student: stRecord[1]
Change the name from Raman to Raghav: stRecord[0] = "Raghav"