Skip to content

Instantly share code, notes, and snippets.

@newsundram2018
Created June 27, 2019 06:44
Show Gist options
  • Save newsundram2018/56b3df5125e68b31654c71dd9cc59290 to your computer and use it in GitHub Desktop.
Save newsundram2018/56b3df5125e68b31654c71dd9cc59290 to your computer and use it in GitHub Desktop.
#PF-Exer-22
def generate_ticket(airline,source,destination,no_of_passengers):
ticket_number_list=[]
#Write your logic here
tn=100
for i in range(1,no_of_passengers+1):
s1=airline+":"+(source[0:3])+":"+(destination[0:3])+":"+(str(tn+i))
ticket_number_list.append(s1)
#Use the below return statement wherever applicable
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",10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment