Page 45 - PYTHON-12
P. 45
Write the following Python function to perform the specified operation:
Add_Update_Display(): to input details of a new customer and store it in CUSTOMERS table. If the
totalPurchases of the new customer is greater than 5000, update the membership field of that customer to
‘Premium’. The function should then retrieve and display all the records from CUSTOMERS table where the
City is ‘New York’ and the membership is ‘Premium’.
Assume the following for Python-Database connectivity:
Host: localhost
User: admin
Password: shop2024
Section E
36. An insurance company needs to store details of its policyholders with the following fields: (5)
• Policy_ID – integer
• Policyholder_Name – string
• Policy_Type – string
• Premium – float
Write Python functions for the following:
1. To input policyholder details and append them to a binary file.
2. To change Policy_Type to ‘Premium’ for all policyholders whose premium is above 5000.
3. To read the binary file and display the details of policyholders whose Policy_Type is ‘Standard’.
37. A logistics company, FastRoute, is establishing a new branch in Hyderabad. The branch has four operational
zones: SHIPPING, WAREHOUSE, OFFICE and IT_SUPPORT while the HEAD OFFICE is in Bengaluru.
Building-to-building distance in the Hyderabad campus is as follows: (5)
HYDERABAD BENGALURU
SHIPPING WAREHOUSE
OFFICE IT SUPPORT
Building-to-building distance:
From To Distance
SHIPPING WAREHOUSE 60 m
SHIPPING OFFICE 80 m
SHIPPING IT_SUPPORT 50 m
WAREHOUSE OFFICE 70 m
WAREHOUSE IT_SUPPORT 40 m
OFFICE IT_SUPPORT 30 m
Distance between Bengaluru head office and Hyderabad campus: 500 km
A.8 Computer Science–XII