// Numbas version: exam_results_page_options {"name": "Count the number of occurrences (frequencies) of each distinct element in a list", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Count the number of occurrences (frequencies) of each distinct element in a list", "tags": [], "metadata": {"description": "

Should not be used: there's now a built-in function frequencies.

\n

This question randomly generates a list of 100 items, each chosen from a list of strings.

\n

It then computes the number of occurrences of each distinct item in the list. The statement shows the frequencies in a table.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

{table(frequencies,[\"Item\",\"Frequency\"])}

", "advice": "", "rulesets": {}, "extensions": [], "variables": {"collection": {"name": "collection", "group": "Ungrouped variables", "definition": "repeat(random(\"pizza\",\"burger\",\"curry\",\"sandwich\"),100)", "description": "", "templateType": "anything"}, "frequencies": {"name": "frequencies", "group": "Ungrouped variables", "definition": "map(\n [item,len(filter(x=item,x,collection))],item,set(collection)\n)", "description": "

A list of pairs of the form [item, frequency], listing the number of occurrences of each distinct item in collection.

", "templateType": "anything"}, "ask_about,num_asked_about": {"name": "ask_about,num_asked_about", "group": "Ungrouped variables", "definition": "random(frequencies)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["ask_about,num_asked_about", "collection", "frequencies"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

How many {ask_about} are there?

", "minValue": "num_asked_about", "maxValue": "num_asked_about", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "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/"}]}