CBSE Class 12 Computer Science
Question 103 of 136
Data File Handling — Question 42
Back to all questionsLet the file "Student.dat" include the following sample data:
Radhika 80
Shaurya 35
Sonia 38
Anirudh 45
import pickle
def display_students(file_name):
file = open(file_name, 'rb')
students = pickle.load(file)
for student in students:
name = student[0]
score = student[1]
if score < 40:
print(name)
file.close()
display_students('student.dat')Shaurya
Sonia