puzzle python code