revised python sample program