doing exercies from Programming Collective Intelligence by Toby Segaran