// Numbas version: exam_results_page_options {"name": "Pad with leading zeros", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"type": "question", "extensions": [], "functions": {}, "advice": "", "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"marks": 1, "showFeedbackIcon": true, "prompt": "

{time}

", "matchMode": "exact", "showCorrectAnswer": true, "displayAnswer": "{time}", "variableReplacementStrategy": "originalfirst", "scripts": {}, "answer": "{time}", "variableReplacements": [], "type": "patternmatch"}], "ungrouped_variables": ["n", "padded_n", "hours", "minutes", "time"], "name": "Pad with leading zeros", "tags": [], "statement": "", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Shows how to use the JME function lpad to add zeros to the beginning of a number so it's always displayed using two digits.

"}, "rulesets": {}, "preamble": {"js": "", "css": ""}, "variables": {"hours": {"definition": "random(0..23)", "group": "Ungrouped variables", "description": "", "templateType": "anything", "name": "hours"}, "n": {"definition": "random(0..19#1)", "group": "Ungrouped variables", "description": "", "templateType": "randrange", "name": "n"}, "minutes": {"definition": "random(0..59)", "group": "Ungrouped variables", "description": "", "templateType": "anything", "name": "minutes"}, "time": {"definition": "lpad(string(hours),2,'0')+\":\"+lpad(string(minutes),2,'0')", "group": "Ungrouped variables", "description": "", "templateType": "anything", "name": "time"}, "padded_n": {"definition": "lpad(string(n),2,'0')", "group": "Ungrouped variables", "description": "", "templateType": "anything", "name": "padded_n"}}, "variable_groups": [], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}