Am 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 consider ai as the value for airline src and dest should be the first three characters of the source and destination cities. number should be auto-generated starting from 101 the program should return the list of ti
Answers
Answered by
5
Explanation:
Consider AI as the value for airline
src and dest should be the first three characters of the source and destination cities.
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.
def generate_ticket(airline,source,destination,no_of_passengers):
ticket_number_list=[]
l=[]
count=101
for i in range (0,no_of_passengers):
src=source[0:3]
des=destination[0:3]
ticket_number_list.append(airline+":"+src+":"+des+":"+str(count))
count+=1
if(no_of_passengers<5):
return ticket_number_list
else:
return ticket_number_list[-5:]
Answered by
0
......…,……………......????????!!!!!!’mnmm
Similar questions