I need it to be simple more than this. Student level # two dimensional tuple to

I need it to be simple more than this. Student level
# two dimensional tuple to store 3 flights
flights = ((‘EK004’, ‘London’, ’12:30′),
(‘EK012’, ‘Paris’, ’14:00′), (‘EK052’, ‘Male’, ’16:15′))
# TO STORE Data of different people
PeopleDetail = []
# this function math input flght number with store flights number.
def checkFlightNumber(flightnumber):
for n in range(0, 3):
if (flights[n][0] == flightnumber): # if flight number is valid
return True # return true
return False # if flight number is invalid return false
# creating manifest for each flight number
def createmanifest():
f = open(“EK004.in”, “w”)
f1 = open(“EK012.in”, “w”)
f2 = open(“EK052.in”, “w”)
for n in range(len(PeopleDetail)):
if (PeopleDetail[n][0] == ‘EK004’):
f.write(‘Flight number: EK004n’)
f.write(PeopleDetail[n][1])
f.write(‘,’)
f.write(PeopleDetail[n][2])
f.write(‘,’)
f.write(PeopleDetail[n][3])
f.write(‘n’)
elif (PeopleDetail[n][0] == ‘EK012’):
f1.write(‘Flight number: EK012n’)
f1.write(PeopleDetail[n][1])
f1.write(‘,’)
f1.write(PeopleDetail[n][2])
f1.write(‘,’)
f1.write(PeopleDetail[n][3])
f1.write(‘n’)
else:
f2.write(‘Flight number: EK052n’)
f2.write(PeopleDetail[n][1])
f2.write(‘,’)
f2.write(PeopleDetail[n][2])
f2.write(‘,’)
f2.write(PeopleDetail[n][3])
f2.write(‘n’)
f.close()
f1.close()
f2.close()
# displaying the manifest for each flights
def displaymannifest():
f = open(“EK004.in”, “r”)
f1 = open(“EK012.in”, “r”)
f2 = open(“EK052.in”, “r”)
print(f.read())
print(f1.read())
print(f2.read())
f.close()
f1.close()
f2.close()
# main code start here
choice = input(‘n: stop nOther Input: to continuenEnter : ‘)
while (choice != ‘n’):
detail = []
while(1):
user_flightnumber = input(‘Enter Flight Number :’)
if (checkFlightNumber(user_flightnumber) == False):
print(“This flight number is Invalid. Please Try Again n”)
else:
break
detail.append(user_flightnumber)
UserName = input(‘Enter your name : ‘)
detail.append(UserName)
UserDOB = input(‘Enter Date of Birth (D/M/Y) : ‘)
detail.append(UserDOB)
UserPassport = input(‘Enter Passport Number : ‘)
detail.append(UserPassport)
choice = input(
‘n—————-nn: stop nOther Input: to continuenEnter : ‘)
PeopleDetail.append(detail)
# creating manifest for each flight number
createmanifest()
# display the each manifest
print(‘nn’)
displaymannifest()

Leave a Reply

Your email address will not be published.