Write a python program to generate the ticket numbers for specified number of passengers traveling in a flight as per the details mentioned below:
The ticket number should be generated as airline:src:dest:number
where

  1. Consider AI as the value for airline
  2. src and dest should be the first three characters of the source and destination cities.
  3. number should be auto-generated starting from 101

The program should return the list of ticket numbers of last five passengers.
Note: If passenger count is less than 5, return the list of all generated ticket numbers.

Sample Input

Expected Output

airline = AI
source = Bangalore
destination = London
no_of_passengers = 10

['AI:Ban:Lon:106', 'AI:Ban:Lon:107', 'AI:Ban:Lon:108', 'AI:Ban:Lon:109', 'AI:Ban:Lon:110']

airline = BA
source = Australia
destination = France
no_of_passengers = 2

['BA:Aus:Fra:101', 'BA:Aus:Fra:102']

 

SOLUTION: