Created
June 27, 2019 06:44
-
-
Save newsundram2018/56b3df5125e68b31654c71dd9cc59290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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