PASSENGERS.DAT stores the records of passengers using the following structure:Create() – to input data for passengers and write it in the binary file PASSENGERS.DAT.SearchDestn(D) – to read contents from the file PASSENGERS.DAT and display the details of those Passengers whose DESTN matches with the value of D.UpdateFare() – to increase the fare of all passengers by 5% and rewrite the updated records into the file PASSENGERS.DAT.
import pickle
def Create():
with open("PASSENGERS.DAT", "wb") as f:
n = int(input("Enter number of passengers: "))
for i in range(n):
PNR = input("Enter PNR: ")
PName = input("Enter Name: ")
BRDSTN = input("Enter Boarding Station: ")
DESTN = input("Enter Destination Station: ")
FARE = float(input("Enter Fare: "))
rec = [PNR, PName, BRDSTN, DESTN, FARE]
pickle.dump(rec, f)
Explanation:
def SearchDestn(D):
try:
with open("PASSENGERS.DAT", "rb") as f:
print("Passengers going to", D)
while True:
rec = pickle.load(f)
if rec[3].lower() == D.lower():
print(rec)
except EOFError:
pass
except FileNotFoundError:
print("File not found.")
Explanation:
def UpdateFare():
updated = []
try:
with open("PASSENGERS.DAT", "rb") as f:
while True:
rec = pickle.load(f)
rec[4] = round(rec[4] * 1.05, 2)
updated.append(rec)
except EOFError:
pass
except FileNotFoundError:
print("File not found.")
return
with open("PASSENGERS.DAT", "wb") as f:
for rec in updated:
pickle.dump(rec, f)
Explanation:fruits = ['apple','banana','cherry'] print(fruits[0])
def sayHello():
print("Hello World")
sayHello()
sayHello()
A racing track is built around an elliptical ground whose equation is given by \[ 9x^2 + 16y^2 = 144 \] The width of the track is \(3\) m as shown. Based on the given information answer the following: 
(i) Express \(y\) as a function of \(x\) from the given equation of ellipse.
(ii) Integrate the function obtained in (i) with respect to \(x\).
(iii)(a) Find the area of the region enclosed within the elliptical ground excluding the track using integration.
OR
(iii)(b) Write the coordinates of the points \(P\) and \(Q\) where the outer edge of the track cuts \(x\)-axis and \(y\)-axis in first quadrant and find the area of triangle formed by points \(P,O,Q\).