a simple conversion of the book c and data structures into python