Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
6.1k views
in Computer by (49.6k points)
closed by

A Binary file, CINEMA.DAT has the following structure: 

{MNO:[MNAME, MTYPE]} 

Where 

MNO – Movie Number 

MNAME – Movie Name 

MTYPE is Movie Type 

Write a user defined function, findType(mtype), that accepts mtype as parameter and displays all the records from the binary file CINEMA.DAT, that have the value of Movie Type as mtype.

1 Answer

+1 vote
by (51.9k points)
selected by
 
Best answer
def Searchtype (mtype): 

   fObj = open("CINEMA.DAT", "rb")

   try:

     while True:

        data pickle.load(fobj)

        if data[2] == mtype:

               print ("Movie number:", data[0]) 

               print ("Movie Name:", data[1]) 

               print ("Movie Type:", data [2])

   except EOFError:

          fObj.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

...