- for selected in answer['closed_part']:
- option = get_option(exercise['options'], selected)
- toret += '%s: %s\n' % (selected, option['text'])
+ if len(answer['closed_part']):
+ for selected in answer['closed_part']:
+ option = get_option(exercise['options'], selected)
+ toret += '%s: %s\n' % (selected, option['text'])