Python puzzle generator