Aan de slagGa gratis aan de slag

Flying home

Your boss assigned you to a small project. They are performing an analysis of the travels people made to attend business meetings. You are given a dataset with only the email subjects for each of the people traveling.

You learn that the text followed a pattern. Here is an example:

Here you have your boarding pass LA4214 AER-CDB 06NOV.

You need to extract the information about the flight:

  • The two letters indicate the airline (e.g LA),
  • The 4 numbers are the flight number (e.g. 4214).
  • The three letters correspond to the departure (e.g AER),
  • The destination (CDB),
  • The date (06NOV) of the flight.

All letters are always uppercase.

The variable flight containing one email subject was loaded in your session. You can use print() to view it in the IPython Shell.

Deze oefening maakt deel uit van de cursus

Regular Expressions in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import re
____
Code bewerken en uitvoeren