Exercise 1

Read the lines from 'clients.txt', then convert each line into a tuple of ('first', 'last', age, 'phone number') fields. In particular, make sure that the age field is converted to an integer type, not a string!

For example, the line

'Stella Do 39 217-325-1432'
should become
('Stella', 'Do', 39, '217-325-1432')

Exercise 2

  1. Write a method which takes the client data and a column number and sorts the entries according to that column.
  2. Extend this to support "named" columns. For example, I still want to be able to sort using column 0, 1, 2 or 3 as before, but I should also be able to sort by "first name", "last name", "age" or "phone number" too.

Exercise 3

Complete our database processing by writing the table sorted by age to 'people.age.txt'.