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
2
stRecord = ['Raman','A-36',[56,98,99,72,69], 78.8]
st_record = {
"name": stRecord[0],
"roll_no": stRecord[1],
"marks": stRecord[2],
"max_marks": max(stRecord[2]),
"marks_5th_sub": stRecord[2][-1],
"percentage": stRecord[-1]
}
# change name
st_record["name"] = "Raghav"
for k, v in st_record.items():
if k != "marks":
print(f"{k}: {v}")
Similar questions
India Languages,
2 months ago
Math,
2 months ago
Social Sciences,
2 months ago
Math,
4 months ago
Biology,
4 months ago
Geography,
10 months ago
Geography,
10 months ago