Exercise from book learn coding the hard way