# How Flight Works 9, Exercise 1: which flight levels fit which direction? # A simple rule used in many regions: eastbound traffic (track 0-179) uses odd levels, westbound (180-359) uses even ones, so opposing aircraft are a level apart. # Illustrative model only, not operating guidance. def level_ok(fl, track): odd = (fl // 10) % 2 == 1 east = 0 <= track < 180 return odd == east for track in (90, 270, 45, 200): levels = [fl for fl in range(290, 420, 10) if level_ok(fl, track)] print("track", track, "->", levels) # Output when run: # track 90 -> [290, 310, 330, 350, 370, 390, 410] # track 270 -> [300, 320, 340, 360, 380, 400] # track 45 -> [290, 310, 330, 350, 370, 390, 410] # track 200 -> [300, 320, 340, 360, 380, 400] # # Opposing aircraft can never be given the same level, because one direction is odd and the other even. Local rules vary, so this is a teaching model.