Question 17
Consider the following Python code and answer the sub-questions:
students = [
{
"name": "Arya",
"subjects": {
"Math": 78, "Science": 88, "English": 92
}
},
{
"name": "Bilal",
"subjects": {
"Math": 65, "Science": 55, "English": 60
}
},
{
"name": "Chitra",
"subjects": {
"Math": 45, "Science": 40, "English": 42
}
},
{
"name": "Deep",
"subjects": {
"Math": 90, "Science": 91, "English": 85
}
},
{
"name": "Esha",
"subjects": {
"Math": 35, "Science": 39, "English": 55
}
},
]
def filter_and_rank(data):
eligible = []
for student in data:
marks = list(student["subjects"].values())
passed = 0
high = 0
for mark in marks:
if mark >= 40:
passed += 1
if mark >= 90:
high += 1
if passed == len(marks) and high > 0:
total = sum(marks)
eligible.append((student["name"], total))
eligible.sort(key=lambda x: x[1], reverse=True)
return [name for name, _ in eligible]
If a new student {"name": "Fatima", "subjects": {"Math": 90, "Science": 90, "English": 90}} is added to the list, what will be the new position (1-based index) of Fatima in the ranked output list returned by filter_and_rank ?