%try: % eval(f'from {__name__} import *') %except: % pass %end %def chok(ok): % if ok: #✔ \\ % else: #✘ \\ % end %end %def chanswer( % idx=None % ,examples=get('example',None) % ,names=get('names',None) % ,choices=get('choices',None) % ): % if idx is None: % idxs = range(len(results)) % else: % idxs = [idx] % end % for idx in idxs: % try: % name = names[idx]
{{name}} % except: % pass % end % try: % example = examples[idx] % except: % example = '' % end % try: % choice = choices[idx] % except: % choice = '' % end % if choice: % for i,val in enumerate(choice): {{str(i+1)}}. {{val}}
% end % else: % if not answered: {{example}} % if points[idx] > 0: [{{points[idx]}}P]\\ % end % else: % if defined('show'): {{!show(results[idx])}}\\ % else: {{!results[idx]}}\\ % end % end % end % if answered: % if answers[idx].strip() != '': ({{answers[idx]}} \\ % chok(bool(oks[idx])) ) % end % if oks[idx]: [{{points[idx]}}P] % else: [0P] % end % end % end %end %def chinc(lnk, nr): % withnr = str(nr)
% include(lnk,withnr=withnr)
%end %if defined('withnr') and withnr: %if not __name__.endswith('chcko/chelper'): % nm = __name__.replace('chcko.','')
{{withnr}} {{nm}} % if points: {{sum(points)}}P % end
%end %end