Computer Science, asked by krishnakoonoth2230, 7 months ago

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 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.Suppose it is mandatory to have the following types of food in the lunch menu of the passengers. Food items are Welcome Drink, Veg Starter, Non-Veg Starter, Veg Main Course, Non-Veg Main Course, Dessert How can we store it such that no one can modify the elements and write in detail.

Answers

Answered by kavitaujjwal1984
1

Answer:

Write a python program to generate the ticket numbers for specified number of passengers traveling in a flight as per the details mentioned below:

Explanation:

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 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:]

#Provide different values for airline,source,destination,no_of_passengers and test your program

print(generate_ticket("AI","Bangalore","London",7))

hope it helps please support

Similar questions