☑Kizspy.me
with open("lab_reservation.txt", "", encoding="utf-8") as file:
reader csv.DictReader(file)
reservations = list(reader)
Question 2. Find Busiest Room (1 mark)
• Write a function to find the room that has the most reservations. Print the room name
and total number of bookings.
Question 3. Get Morning Reservations (1 mark)
• A reservation is considered morning if the time slot is before 12:00. Write a function
that returns a list of all reservations in the morning and print the number of such
bookings.
Question 4: Export Morning Reservations (1.5 marks)

Export all morning reservations (from Q3) into a file called morning_reservations.csv
with the original 5 columns. Include a header row.
Question 5. Store Reservations in SQLite (1.5 marks)
• Create a SQLite database lab.db and a table reservations with columns: id
(INTEGER PRIMARY KEY AUTOINCREMENT), student_id, student_name, room,
date, time slot Insert all data from the file into the database.
Question 6. Query Afternoon in Deep Blue Lab (1 mark)
• Write a SQL query using Python to retrieve and print all reservations made in Deep
Blue Lab after 12:00. Print student name, date, and time slot.
Question 7: Generate Booking Statistics (1.5 marks)
• Write a function that prints: Number of reservations per room, Number of
reservations per day, Total number of unique students.
Question 8: Plot Room Usage (1 mark)
• Use matplotlib to create a bar chart showing the number of reservations for each
room. Label the bars clearly.
Zoom
+ 100%
Close