English

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] - Computer Science (Python)

Advertisements
Advertisements

Question

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.

  1. Percentage of the student
  2. Marks in the fifth subject
  3. Maximum marks of the student
  4. Roll no. of the student
  5. Change the name of the student from ‘Raman’ to ‘Raghav’.
Answer in Brief
Advertisements

Solution

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


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 that contains 5 elements, and 'percentage' at index 3.

  1. Percentage: stRecord[3]
  2. Marks in 5th Subject: stRecord[2][4]
  3. Maximum Marks of the Student: max(stRecord[2])
  4. Roll no. of the student: stRecord[1]
  5. Change the name from Raman to Raghav: stRecord[0] = "Raghav".
shaalaa.com
Lists Manipulation in Python
  Is there an error in this question or solution?
Chapter 9: Lists - Exercise [Page 205]

APPEARS IN

NCERT Computer Science [English] Class 11
Chapter 9 Lists
Exercise | Q 7. | Page 205
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×