// Numbas version: exam_results_page_options {"name": "Several variables corresponding to a scenario - Swansea", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "type": "question", "statement": "

Mary lives in {city}. The population of {city} is {separateThousands(population,\",\")}.

Multiply the population by the percentage:

\n

\$\\var{latex(separateThousands(population,',\\\\!'))} \\times \\var{percent_like_chocolate}\\% = \\var{num_like_chocolate} \$

", "functions": {}, "ungrouped_variables": [], "variables": {"city": {"name": "city", "description": "", "group": "Chosen scenario", "templateType": "anything", "definition": "cities[scenario]"}, "populations": {"name": "populations", "description": "", "group": "Data", "templateType": "list of numbers", "definition": "[ 58560, 24064, 12064, 10459, 132512 ]"}, "cities": {"name": "cities", "description": "", "group": "Data", "templateType": "list of strings", "definition": "[ \"Lowestoft\", \"Bognor Regis\", \"Maryport\", \"Fort William\", \"Norwich\" ]"}, "percent_like_chocolate": {"name": "percent_like_chocolate", "description": "", "group": "Chosen scenario", "templateType": "anything", "definition": "percents_like_chocolate[scenario]"}, "num_like_chocolate": {"name": "num_like_chocolate", "description": "", "group": "Chosen scenario", "templateType": "anything", "definition": "round(population*percent_like_chocolate/100)"}, "scenario": {"name": "scenario", "description": "", "group": "Chosen scenario", "templateType": "anything", "definition": "random(0..len(cities)-1)"}, "population": {"name": "population", "description": "", "group": "Chosen scenario", "templateType": "anything", "definition": "populations[scenario]"}, "percents_like_chocolate": {"name": "percents_like_chocolate", "description": "", "group": "Data", "templateType": "list of numbers", "definition": "[ 12, 34, 45, 82, 71 ]"}}, "metadata": {"description": "

Choose from one of several pre-defined scenarios, and set variables to the corresponding values, defined in lists.

\n

This question has three variables: city, population, and percent_like_chocolate. These differ for each city. We've defined a list for each variable, with the corresponding values. A variable called scenario picks a random position in the list, so the value of city, for example, is cities[scenario].

", "licence": "Creative Commons Attribution 4.0 International"}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Angharad Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/315/"}], "rulesets": {}, "parts": [{"showCorrectAnswer": true, "precisionType": "dp", "correctAnswerFraction": false, "precision": 0, "strictPrecision": false, "allowFractions": false, "prompt": "

{percent_like_chocolate}% of the residents of {city} like chocolate.

\n

How many people in {city} like chocolate?

", "type": "numberentry", "minValue": "num_like_chocolate", "variableReplacements": [], "showPrecisionHint": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "marks": 1, "maxValue": "num_like_chocolate", "correctAnswerStyle": "plain", "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true}], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [{"name": "Data", "variables": ["cities", "populations", "percents_like_chocolate"]}, {"name": "Chosen scenario", "variables": ["scenario", "city", "population", "percent_like_chocolate", "num_like_chocolate"]}], "name": "Several variables corresponding to a scenario - Swansea", "preamble": {"js": "", "css": ""}}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Angharad Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/315/"}]}