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.Use csv.writer to write data to a CSV file and csv.reader to read data from a CSV file. Handle exceptions for invalid or header rows when processing numeric values.
The Add_Device()
function:
Peripheral.csv
in append mode.csv.writer()
.
The Count_Device()
function:
Peripheral.csv
in read mode.
print(16 * 5 / 4 * 2 / 5 - 8)
a = 20 def convert(a): b = 20 a = a + b convert(10) print(a)Select the correct output from the given options:
Fill in the blank:
\(\_\_\_\_\_\_\_\_\) is a set of rules that needs to be followed by the communicating parties in order to have a successful and reliable data communication over a network.
Read the following characteristics of retail trading carefully and choose the correct option:
I. This is concerned with the sale of goods directly to the consumers.
II. Most of the retail trading takes place in fixed establishments or stores.
III. It is formed by many middlemen, traders, and suppliers.
IV. Hawkers, street peddling, automatic vending machines, etc., are its examples.
Read the programmes related to the proposed Bharatmala umbrella scheme carefully and choose the correct option:
I. Backward areas, religious and tourist places connectivity programme
2. To interconnect the four metropolitan cities of the country
3. To develop State roads in adjoining coastal areas
4. To connect non-major ports in coastal states