BasicFiles & CSV10 points

How late is this airline?

An airport operations team publishes a weekly punctuality note. The raw data is flights.csv, one row per scheduled flight in March 2025.

  • flight_id: unique flight code
  • airline: airline name
  • origin, dest: airport codes
  • date: scheduled day
  • delay_min: minutes late at arrival (negative means early); empty when the flight was cancelled
  • cancelled: 1 if cancelled, otherwise 0

Task: read an airline name (exactly as written in the file) from one input line. Print three lines: Flights: N (all rows of that airline, cancelled ones included), Cancelled: C, and Late minutes: S where S is the sum of delay_min over the non-cancelled flights whose delay is greater than 0 (early flights add nothing). An airline with no rows gives 0 on every line.

Files your program can read

flights.csv221 lines
flight_id,airline,origin,dest,date,delay_min,cancelled
FL1001,Pacific Jet,LHR,SYD,2025-03-30,1,0
FL1002,Sahara Express,DEL,LHR,2025-03-27,-6,0
FL1003,Sahara Express,GRU,FRA,2025-03-07,26,0
FL1004,Andes Connect,DEL,DXB,2025-03-12,-2,0
FL1005,Andes Connect,NBO,YYZ,2025-03-26,41,0
FL1006,Sahara Express,FRA,DXB,2025-03-26,40,0
FL1007,Sahara Express,SYD,SIN,2025-03-05,12,0
...

Open them by name, for example open("flights.csv").

Sample test

Input

Nordwind

Expected output

Flights: 36
Cancelled: 1
Late minutes: 1313

Your answer is also checked against 4 hidden tests.

Need a hint?

Cancelled rows have an empty delay_min, so check the cancelled column before calling int().