Fewpal
0 votes
301 views
in Computer by (70.5k points)

Consider the following class declaration and answer the question that follows:

Anuj has been asked to display all the students who have scored less than 40 for Remedial Classes.

Write a user defined function to display all those students who have scored less than 40 from the binary file “Student.dat” assuming it stores all the object of the class Student mentioned above.

1 Answer

+1 vote
by (75.6k points)
selected by
 
Best answer

def displaydata():

x=open("student.dat", "rb")

S = Student()

try:

while (X):

s=pickle.load(X)

if (s.returnpercent () < 40):

s.displaydata()

except EOFError:

pass

x.close()

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...