Computer Science, asked by TeeshaAhuja, 9 months ago

. 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

Answered by Equestriadash
19

Given list:

  • stRecord = ['Raman','A-36',[56,98,99,72,69], 78.8]

Statements to retrieve the following information:

a) Percentage of the student.

  • print(stRecord[3])

b) Marks in the fifth subject.

  • print(stRecord[2][4])

c) Maximum marks of the student.

  • print(stRecord[2][2])

d) Roll No. of the student.

  • print(stRecord[1])

e) Change the name of the student from  ‘Raman’ to ‘Raghav’​.

  • stRecord[0] = "Raghav"
  • print(stRecord)

The above mentioned acts can be done using string slicing, which is extracting a substring from a given string.

Similar questions