\[ \begin{array}{|c|c|c|c|} \hline \textbf{S\_id} & \textbf{S\_name} & \textbf{Address} & \textbf{S\_type} \\ \hline S001 & Sandhya & Rohini & Day Boarder \\ S002 & Vedanshi & Rohtak & Day Scholar \\ S003 & Vibhu & Raj Nagar & NULL \\ S004 & Atharva & Rampur & Day Boarder \\ \hline \end{array} \]
\[ \begin{array}{|c|c|c|} \hline \textbf{S\_id} & \textbf{Bus\_no} & \textbf{Stop\_name} \\ \hline S002 & TSS10 & Sarai Kale Khan \\ S004 & TSS12 & Sainik Vihar \\ S005 & TSS10 & Kamla Nagar \\ \hline \end{array} \]
Sangeeta is a Python programmer working in a computer hardware company. She has to maintain the records of the peripheral devices. She created a csv file named Peripheral.csv
to store the details. Structure of Peripheral.csv
:
\begin{tabular}{|c|c|c|} \hline \textbf{P\_id} & \textbf{P\_name} & \textbf{Price} \\ \hline \end{tabular}
P\_id
is the Peripheral device ID (integer).P\_name
is the Peripheral device name (string).Price
is the Peripheral device price (integer).Sangeeta wants to write the following user-defined functions:
Add\_Device()
: To accept a record from the user and add it to the CSV file, Peripheral.csv
.Count\_Device()
: To count and display the number of peripheral devices whose price is less than 1000.Consider a binary file, items.dat
, containing records stored in the given format:
Write a function, Copy\_new()
, that copies all records whose amount
is greater than 1000 from items.dat
to new\_items.dat
.