Half implemented Advanced question in python