0% found this document useful (0 votes)
7 views

python (1)

The document outlines four sets of programming tasks in Python. Set 1 involves creating a Stack class with basic stack operations. Sets 2, 3, and 4 focus on handling binary files for peripherals and student records, including adding, displaying, and searching for specific data based on given criteria.

Uploaded by

shubh patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

python (1)

The document outlines four sets of programming tasks in Python. Set 1 involves creating a Stack class with basic stack operations. Sets 2, 3, and 4 focus on handling binary files for peripherals and student records, including adding, displaying, and searching for specific data based on given criteria.

Uploaded by

shubh patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Set 1

1. Create a Stack class in Python that supports the following operations:

1) Push(item): Adds an item to the stack.

2) Pop(): Removes the top item from the stack and displays the item.

3) Display(): Displays all the items currently in the stack, starting from the top.

4) IsEmpty(): Returns True if the stack is empty, otherwise False.

Set 2

1) Consider a binary file PERIPHERALS.dat contains the structure [PID, Name, Category and
Price].

Write a menu driven Python program with the following function definitions.

a) ADD() – To add records into the binary file PERIPHERALS.dat

b) DISPLAY() – To display the details of all the peripherals where Price>15000.

c) SEARCH(PID) -To search for the peripheral device which fall under output category

and display the same.

Set 3

1. Write a program to write data into binary file marks.dat and display the records
of students who scored more than 95 marks.

Set 4

1. Write a Python program that performs the following tasks:


a) Accepts student data (Name, Roll Number, and Marks) from the user.
b) Stores the student data in a binary file called students.dat using the pickle
module.
c) After entering the data for 5 students, the program should display the records of
students who have scored more than 80 marks.

Each student should be represented by a class with attributes: name, roll_number, and marks

You might also like