python solution for 29