Boarding Pass Validation

Boarding-Pass-Validation

Scenario


You are writing a computer program for an airline company. The program will be used at a check-in desk to generate and print custom boarding passes.

The program captures several user inputs before generating the pass.

In order to make your program more robust, you decide to implement validation routines so that any invalid input is detected and automatically rejected by the program.

Your task is to complete the code below to implement the following validation checks:

  1. The firstname and lastname of the passenger cannot be left blank,
  2. The airport codes (departure and arrival) have to be exactly 3 characters long,
  3. The airport codes (departure and arrival) should be automatically converted to UPPERCASE,
  4. The program should ask whether or not a QR code will be printed on the boarding pass. Only a “Yes” or a “No” answer should be accepted,
  5. The gate number has to be based on the following format: 1 uppercase letter + 2-digit number,
  6. The flight number has to be based on the following format: 2 uppercase letters + 4-digit number,
  7. The departure and arrival times must be in the 12:60 AM/PM format,
  8. The date must be in the DD/MM/YYYY format.

Complete the code


Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with:

Our Latest Book