diff --git a/pl_to_md/.ipynb_checkpoints/PL to Markdown testing-checkpoint.ipynb b/pl_to_md/.ipynb_checkpoints/PL to Markdown testing-checkpoint.ipynb new file mode 100644 index 00000000..fd4aaebb --- /dev/null +++ b/pl_to_md/.ipynb_checkpoints/PL to Markdown testing-checkpoint.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Convert from PrairieLearn format to a Markdown format" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Python Code section" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [], + "source": [ + "from inspect import getmembers, isfunction\n", + "import importlib\n", + "import examples.Two_blocks_connected_by_a_string.server as server_module" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [], + "source": [ + "path = 'examples/Two_blocks_connected_by_a_string/server.py'\n" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [], + "source": [ + "functions_list = getmembers(server_module, isfunction)" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('generate',\n", + " ),\n", + " ('grade',\n", + " ),\n", + " ('nested_dict',\n", + " ()>),\n", + " ('parse',\n", + " ),\n", + " ('prepare',\n", + " )]" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "functions_list" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'generate'" + ] + }, + "execution_count": 85, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "functions_list[0][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": {}, + "outputs": [], + "source": [ + "code = []\n", + "with open(path,'r') as f:\n", + " code = f.readlines()" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['import random as rd\\n',\n", + " 'import problem_bank_helpers as pbh\\n',\n", + " 'from collections import defaultdict\\n',\n", + " 'nested_dict = lambda: defaultdict(nested_dict)\\n',\n", + " '\\n',\n", + " 'def generate(data):\\n',\n", + " ' # Start problem code\\n',\n", + " ' \\n',\n", + " ' data2 = nested_dict()\\n',\n", + " ' \\n',\n", + " ' # store phrases etc\\n',\n", + " ' data2[\"params\"][\"vars\"][\"title\"] = \\'Two Blocks Connected by a String\\'\\n',\n", + " ' data2[\"params\"][\"vars\"][\"units\"] = \"N\"\\n',\n", + " ' \\n',\n", + " ' # Define variables in case the image is randomized in the future.\\n',\n", + " ' m1 = 1\\n',\n", + " ' m2 = 1.2\\n',\n", + " ' g = 9.81\\n',\n", + " ' \\n',\n", + " ' # store the variables in the dictionary \"params\". \\n',\n", + " ' data2[\"params\"][\"m1\"] = m1\\n',\n", + " ' \\n',\n", + " ' # define possible answers\\n',\n", + " ' # round in traditional way using pbh.roundp() and then convert to int\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans1\"][\"value\"] = int(pbh.roundp(m1*g, decimals = 0)) \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans1\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans2\"][\"value\"] = int(pbh.roundp(m2*g, decimals = 0))\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans2\"][\"correct\"] = True\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans3\"][\"value\"] = int(pbh.roundp(2*m2*g, decimals = 0))\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans3\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans4\"][\"value\"] = int(pbh.roundp(2*m1*g, decimals = 0))\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans4\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans5\"][\"value\"] = int(pbh.roundp(m2*g, decimals = 0)) + 1\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans5\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans6\"][\"value\"] = int(pbh.roundp(m2*g, decimals = 0)) - 1\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans6\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' # Update the data object with a new dict\\n',\n", + " ' data.update(data2)\\n',\n", + " ' \\n',\n", + " 'def prepare(data):\\n',\n", + " ' pass\\n',\n", + " ' \\n',\n", + " 'def parse(data):\\n',\n", + " ' pass\\n',\n", + " ' \\n',\n", + " 'def grade(data):\\n',\n", + " ' pass\\n',\n", + " ' \\n']" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "code " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for line in code:\n", + " if 'data.update(data2)' in line:\n", + " " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/pl_to_md/PL to Markdown testing.ipynb b/pl_to_md/PL to Markdown testing.ipynb index 01b5e4b3..fd4aaebb 100644 --- a/pl_to_md/PL to Markdown testing.ipynb +++ b/pl_to_md/PL to Markdown testing.ipynb @@ -7,12 +7,194 @@ "# Convert from PrairieLearn format to a Markdown format" ] }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import yaml" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Python Code section" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [], + "source": [ + "from inspect import getmembers, isfunction\n", + "import importlib\n", + "import examples.Two_blocks_connected_by_a_string.server as server_module" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [], + "source": [ + "path = 'examples/Two_blocks_connected_by_a_string/server.py'\n" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [], + "source": [ + "functions_list = getmembers(server_module, isfunction)" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('generate',\n", + " ),\n", + " ('grade',\n", + " ),\n", + " ('nested_dict',\n", + " ()>),\n", + " ('parse',\n", + " ),\n", + " ('prepare',\n", + " )]" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "functions_list" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'generate'" + ] + }, + "execution_count": 85, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "functions_list[0][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": {}, + "outputs": [], + "source": [ + "code = []\n", + "with open(path,'r') as f:\n", + " code = f.readlines()" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['import random as rd\\n',\n", + " 'import problem_bank_helpers as pbh\\n',\n", + " 'from collections import defaultdict\\n',\n", + " 'nested_dict = lambda: defaultdict(nested_dict)\\n',\n", + " '\\n',\n", + " 'def generate(data):\\n',\n", + " ' # Start problem code\\n',\n", + " ' \\n',\n", + " ' data2 = nested_dict()\\n',\n", + " ' \\n',\n", + " ' # store phrases etc\\n',\n", + " ' data2[\"params\"][\"vars\"][\"title\"] = \\'Two Blocks Connected by a String\\'\\n',\n", + " ' data2[\"params\"][\"vars\"][\"units\"] = \"N\"\\n',\n", + " ' \\n',\n", + " ' # Define variables in case the image is randomized in the future.\\n',\n", + " ' m1 = 1\\n',\n", + " ' m2 = 1.2\\n',\n", + " ' g = 9.81\\n',\n", + " ' \\n',\n", + " ' # store the variables in the dictionary \"params\". \\n',\n", + " ' data2[\"params\"][\"m1\"] = m1\\n',\n", + " ' \\n',\n", + " ' # define possible answers\\n',\n", + " ' # round in traditional way using pbh.roundp() and then convert to int\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans1\"][\"value\"] = int(pbh.roundp(m1*g, decimals = 0)) \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans1\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans2\"][\"value\"] = int(pbh.roundp(m2*g, decimals = 0))\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans2\"][\"correct\"] = True\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans3\"][\"value\"] = int(pbh.roundp(2*m2*g, decimals = 0))\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans3\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans4\"][\"value\"] = int(pbh.roundp(2*m1*g, decimals = 0))\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans4\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans5\"][\"value\"] = int(pbh.roundp(m2*g, decimals = 0)) + 1\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans5\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans6\"][\"value\"] = int(pbh.roundp(m2*g, decimals = 0)) - 1\\n',\n", + " ' data2[\"params\"][\"part1\"][\"ans6\"][\"correct\"] = False\\n',\n", + " ' \\n',\n", + " ' # Update the data object with a new dict\\n',\n", + " ' data.update(data2)\\n',\n", + " ' \\n',\n", + " 'def prepare(data):\\n',\n", + " ' pass\\n',\n", + " ' \\n',\n", + " 'def parse(data):\\n',\n", + " ' pass\\n',\n", + " ' \\n',\n", + " 'def grade(data):\\n',\n", + " ' pass\\n',\n", + " ' \\n']" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "code " + ] + }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "for line in code:\n", + " if 'data.update(data2)' in line:\n", + " " + ] } ], "metadata": { @@ -31,7 +213,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.3" + "version": "3.9.5" } }, "nbformat": 4, diff --git a/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/info-checkpoint.json b/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/info-checkpoint.json new file mode 100644 index 00000000..da7dc2a9 --- /dev/null +++ b/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/info-checkpoint.json @@ -0,0 +1,7 @@ +{ + "uuid": "ae574feb-fa63-44c5-86e7-732faf5e5ca4", + "title": "Exploding Asteroid", + "topic": "Energy", + "tags": ["AK"], + "type": "v3" + } \ No newline at end of file diff --git a/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/question-checkpoint.html b/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/question-checkpoint.html new file mode 100644 index 00000000..89e1dcbd --- /dev/null +++ b/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/question-checkpoint.html @@ -0,0 +1,20 @@ + +{{ params.vars.name }} and {{ params.vars.name2 }} are both standing in their space ships, each one moving with a constant (but different) velocity. They carefully watch and measure, from their two space ships, an asteroid exploding into two parts. When they compare their final numbers, which of their numbers will agree? + + + + + {{ params.part1.ans1.value }} + {{ params.part1.ans2.value }} + {{ params.part1.ans3.value }} + {{ params.part1.ans4.value }} + {{ params.part1.ans5.value }} + {{ params.part1.ans6.value }} + + + + +--- +Problem is licensed under the [CC-BY-NC-SA 4.0 license](https://creativecommons.org/licenses/by-nc-sa/4.0/).
![The Creative Commons 4.0 license requiring attribution-BY, non-commercial-NC, and share-alike-SA license.](https://raw.githubusercontent.com/firasm/bits/master/by-nc-sa.png) +
+
diff --git a/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/server-checkpoint.py b/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/server-checkpoint.py new file mode 100644 index 00000000..b1123143 --- /dev/null +++ b/pl_to_md/examples/Exploding_Asteroid/.ipynb_checkpoints/server-checkpoint.py @@ -0,0 +1,68 @@ +import random +import pandas as pd +import problem_bank_helpers as pbh +from collections import defaultdict +nested_dict = lambda: defaultdict(nested_dict) + +def generate(data): + # Start problem code + + data2 = nested_dict() + + # define or load names/items/objects + names = pd.read_csv(data["options"]["client_files_course_path"]+"/data/names.csv")["Names"].tolist() + + # store phrases etc + data2["params"]["vars"]["title"] = 'Exploding Asteroid' + data2["params"]["vars"]["name"] = random.choice(names) + data2["params"]["vars"]["name2"] = random.choice(names) + + # define useful variables/lists + + # create list of answers and shuffle + answers = [ + "The momentum vectors they use to describe each of the two asteroid pieces will be the same.", + "The total momentum vectors they use to describe the asteroid system (both pieces) will be the same.", + "The CHANGE in the momentum vector they determine for each piece of the asteroid before and after the explosion will be the same.", + "The FORCE vector they determine that each piece of the asteroid felt during the explosion will be the same.", + "The final velocity vectors they use to describe the two asteroid pieces will be the same.", + "The final speeds they measure for the two asteroid pieces will be the same.", + "They will both agree on how much kinetic energy each of the asteroid pieces has.", + "They will both agree on how the kinetic energy of each of the pieces has changed.", + "They will both agree on how the TOTAL kinetic energy of the system has changed.", + "They will both agree on how the internal energy of the system has changed." + ] + + correct_answers = [ + "The momentum vectors they use to describe each of the two asteroid pieces will be the same.", + "The total momentum vectors they use to describe the asteroid system (both pieces) will be the same.", + "The final velocity vectors they use to describe the two asteroid pieces will be the same.", + "The final speeds they measure for the two asteroid pieces will be the same.", + "They will both agree on how much kinetic energy each of the asteroid pieces has.", + ] + + random.shuffle(answers) + + # Create ans_choices + num_choices = 6 + + for i,this_answer in enumerate(random.sample(answers,num_choices)): + + choice = f"ans{i+1}" + + data2["params"]["part1"][choice]["value"] = this_answer + + if this_answer in correct_answers: + data2["params"]["part1"][choice]["correct"] = False + else: + data2["params"]["part1"][choice]["correct"] = True + +def prepare(data): + pass + +def parse(data): + pass + +def grade(data): + pass + diff --git a/pl_to_md/examples/Exploding_Asteroid/__pycache__/server.cpython-39.pyc b/pl_to_md/examples/Exploding_Asteroid/__pycache__/server.cpython-39.pyc new file mode 100644 index 00000000..e8eadd8e Binary files /dev/null and b/pl_to_md/examples/Exploding_Asteroid/__pycache__/server.cpython-39.pyc differ diff --git a/pl_to_md/examples/Two blocks connected by a string/server.py b/pl_to_md/examples/Two_blocks_connected_by_a_string/.ipynb_checkpoints/server-checkpoint.py similarity index 100% rename from pl_to_md/examples/Two blocks connected by a string/server.py rename to pl_to_md/examples/Two_blocks_connected_by_a_string/.ipynb_checkpoints/server-checkpoint.py diff --git a/pl_to_md/examples/Two_blocks_connected_by_a_string/__pycache__/server.cpython-39.pyc b/pl_to_md/examples/Two_blocks_connected_by_a_string/__pycache__/server.cpython-39.pyc new file mode 100644 index 00000000..10eb04e5 Binary files /dev/null and b/pl_to_md/examples/Two_blocks_connected_by_a_string/__pycache__/server.cpython-39.pyc differ diff --git a/pl_to_md/examples/Two blocks connected by a string/clientFilesQuestion/q7_2012Final.png b/pl_to_md/examples/Two_blocks_connected_by_a_string/clientFilesQuestion/q7_2012Final.png similarity index 100% rename from pl_to_md/examples/Two blocks connected by a string/clientFilesQuestion/q7_2012Final.png rename to pl_to_md/examples/Two_blocks_connected_by_a_string/clientFilesQuestion/q7_2012Final.png diff --git a/pl_to_md/examples/Two blocks connected by a string/info.json b/pl_to_md/examples/Two_blocks_connected_by_a_string/info.json similarity index 100% rename from pl_to_md/examples/Two blocks connected by a string/info.json rename to pl_to_md/examples/Two_blocks_connected_by_a_string/info.json diff --git a/pl_to_md/examples/Two blocks connected by a string/question.html b/pl_to_md/examples/Two_blocks_connected_by_a_string/question.html similarity index 100% rename from pl_to_md/examples/Two blocks connected by a string/question.html rename to pl_to_md/examples/Two_blocks_connected_by_a_string/question.html diff --git a/pl_to_md/examples/Two_blocks_connected_by_a_string/server.py b/pl_to_md/examples/Two_blocks_connected_by_a_string/server.py new file mode 100644 index 00000000..8b22cec3 --- /dev/null +++ b/pl_to_md/examples/Two_blocks_connected_by_a_string/server.py @@ -0,0 +1,54 @@ +import random as rd +import problem_bank_helpers as pbh +from collections import defaultdict +nested_dict = lambda: defaultdict(nested_dict) + +def generate(data): + # Start problem code + + data2 = nested_dict() + + # store phrases etc + data2["params"]["vars"]["title"] = 'Two Blocks Connected by a String' + data2["params"]["vars"]["units"] = "N" + + # Define variables in case the image is randomized in the future. + m1 = 1 + m2 = 1.2 + g = 9.81 + + # store the variables in the dictionary "params". + data2["params"]["m1"] = m1 + + # define possible answers + # round in traditional way using pbh.roundp() and then convert to int + data2["params"]["part1"]["ans1"]["value"] = int(pbh.roundp(m1*g, decimals = 0)) + data2["params"]["part1"]["ans1"]["correct"] = False + + data2["params"]["part1"]["ans2"]["value"] = int(pbh.roundp(m2*g, decimals = 0)) + data2["params"]["part1"]["ans2"]["correct"] = True + + data2["params"]["part1"]["ans3"]["value"] = int(pbh.roundp(2*m2*g, decimals = 0)) + data2["params"]["part1"]["ans3"]["correct"] = False + + data2["params"]["part1"]["ans4"]["value"] = int(pbh.roundp(2*m1*g, decimals = 0)) + data2["params"]["part1"]["ans4"]["correct"] = False + + data2["params"]["part1"]["ans5"]["value"] = int(pbh.roundp(m2*g, decimals = 0)) + 1 + data2["params"]["part1"]["ans5"]["correct"] = False + + data2["params"]["part1"]["ans6"]["value"] = int(pbh.roundp(m2*g, decimals = 0)) - 1 + data2["params"]["part1"]["ans6"]["correct"] = False + + # Update the data object with a new dict + data.update(data2) + +def prepare(data): + pass + +def parse(data): + pass + +def grade(data): + pass + diff --git a/pl_to_md/expected_md/Exploding_Asteroid/.ipynb_checkpoints/Exploding_Asteroid-checkpoint.md b/pl_to_md/expected_md/Exploding_Asteroid/.ipynb_checkpoints/Exploding_Asteroid-checkpoint.md new file mode 100644 index 00000000..8d10ae86 --- /dev/null +++ b/pl_to_md/expected_md/Exploding_Asteroid/.ipynb_checkpoints/Exploding_Asteroid-checkpoint.md @@ -0,0 +1,120 @@ +--- +title: Exploding Asteroid +topic: Energy +author: Jake Bobowski +source: Final 2016 Q6 +template_version: 1.0 +attribution: standard +outcomes: +- 8.2.1.1 +difficulty: +- undefined +randomization: +- undefined +taxonomy: +- undefined +tags: +- AK +assets: +server: + imports: | + import random + import pandas as pd + import problem_bank_helpers as pbh + from collections import defaultdict + nested_dict = lambda: defaultdict(nested_dict) + generate: | + # Start problem code + + data2 = nested_dict() + + # define or load names/items/objects + names = pd.read_csv("data/names.csv")["Names"].tolist() + + # store phrases etc + data2["params"]["vars"]["title"] = 'Exploding Asteroid' + data2["params"]["vars"]["name"] = random.choice(names) + data2["params"]["vars"]["name2"] = random.choice(names) + + # define useful variables/lists + + # create list of answers and shuffle + answers = [ + "The momentum vectors they use to describe each of the two asteroid pieces will be the same.", + "The total momentum vectors they use to describe the asteroid system (both pieces) will be the same.", + "The CHANGE in the momentum vector they determine for each piece of the asteroid before and after the explosion will be the same.", + "The FORCE vector they determine that each piece of the asteroid felt during the explosion will be the same.", + "The final velocity vectors they use to describe the two asteroid pieces will be the same.", + "The final speeds they measure for the two asteroid pieces will be the same.", + "They will both agree on how much kinetic energy each of the asteroid pieces has.", + "They will both agree on how the kinetic energy of each of the pieces has changed.", + "They will both agree on how the TOTAL kinetic energy of the system has changed.", + "They will both agree on how the internal energy of the system has changed." + ] + + correct_answers = [ + "The momentum vectors they use to describe each of the two asteroid pieces will be the same.", + "The total momentum vectors they use to describe the asteroid system (both pieces) will be the same.", + "The final velocity vectors they use to describe the two asteroid pieces will be the same.", + "The final speeds they measure for the two asteroid pieces will be the same.", + "They will both agree on how much kinetic energy each of the asteroid pieces has.", + ] + + random.shuffle(answers) + + # Create ans_choices + num_choices = 6 + + for i,this_answer in enumerate(random.sample(answers,num_choices)): + + choice = f"ans{i+1}" + + data2["params"]["part1"][choice]["value"] = this_answer + + if this_answer in correct_answers: + data2["params"]["part1"][choice]["correct"] = False + else: + data2["params"]["part1"][choice]["correct"] = True + prepare: | + pass + parse: | + pass + grade: | + pass +part1: + type: checkbox + pl-customizations: + weight: 1 + partial-credit: true + partial-credit-method: EDC +--- +# {{ params.vars.title }} + +## Question Text + +{{ params.vars.name }} and {{ params.vars.name2 }} are both standing in their space ships, each one moving with a constant (but different) velocity. They carefully watch and measure, from their two space ships, an asteroid exploding into two parts. When they compare their final numbers, which of their numbers will agree? + +### Answer Section + +Select all the choices that apply. + +Note: You will be awarded full marks only if you select all the correct choices, and none of the incorrect choices. Choosing incorrect choices as well as not choosing correct choices will result in deductions. + +- {{ params.part1.ans1.value }} +- {{ params.part1.ans2.value }} +- {{ params.part1.ans3.value }} +- {{ params.part1.ans4.value }} +- {{ params.part1.ans5.value }} +- {{ params.part1.ans6.value }} + +## Rubric + +This should be hidden from students until after the deadline. + +## Solution + +This should never be revealed to students. + +## Comments + +These are random comments associated with this question.