Upload tmpl_code/tc_tp4_1791579464_00005.jsonl with huggingface_hub
Browse files
tmpl_code/tc_tp4_1791579464_00005.jsonl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"tid": "a93b59f8ee", "cat": "probability", "code": "def make(rng, original=False):\n if original:\n question = (\n \"A music producer is mixing a new album for a rock icon. He has 8 unique backing tracks \"\n \"and 5 unique lead vocal takes. For each of the 10 tracks on the final album, he must choose \"\n \"exactly one backing track and exactly one vocal take. If the choices are made independently \"\n \"and uniformly at random for each track, what is the probability that the exact same pairing \"\n \"of backing track and vocal take is used for all 10 album tracks?\"\n )\n lines = [\n \"Total possible pairings per track: 8 * 5 = 40\",\n \"Total possible sequences for 10 tracks: 40^10\",\n \"Favorable sequences (all 10 tracks identical): 40\",\n \"Probability: 40 / 40^10\",\n \"Simplified probability: 1 / 40^9\",\n ]\n return question, lines, \"1/40^9\"\n\n a = rng.randint(2, 12)\n b = rng.randint(2, 12)\n n = rng.randint(2, 12)\n p = a * b\n exp = n - 1\n\n if p <= 1 or exp <= 0:\n return None\n\n subject = rng.choice([\n \"A music producer\",\n \"A sound engineer\",\n \"A mix engineer\",\n \"A record producer\",\n \"An audio engineer\",\n ])\n artist = rng.choice([\n \"a rock icon\",\n \"an indie artist\",\n \"a pop star\",\n \"a jazz musician\",\n \"a country singer\",\n \"a metal band\",\n ])\n backing = rng.choice([\n (\"backing tracks\", \"backing track\"),\n (\"instrumental stems\", \"instrumental stem\"),\n (\"rhythm sections\", \"rhythm section\"),\n (\"guitar tracks\", \"guitar track\"),\n (\"drum tracks\", \"drum track\"),\n ])\n vocal = rng.choice([\n (\"lead vocal takes\", \"lead vocal take\"),\n (\"vocal takes\", \"vocal take\"),\n (\"vocal lines\", \"vocal line\"),\n (\"melody takes\", \"melody take\"),\n (\"lead vocal recordings\", \"lead vocal recording\"),\n ])\n\n if rng.random() < 0.5:\n first_count, first_plural, first_singular = a, backing[0], backing[1]\n second_count, second_plural, second_singular = b, vocal[0], vocal[1]\n else:\n first_count, first_plural, first_singular = b, vocal[0], vocal[1]\n second_count, second_plural, second_singular = a, backing[0], backing[1]\n\n question = (\n f\"{subject} is mixing a new album for {artist}. There are {first_count} unique {first_plural} \"\n f\"and {second_count} unique {second_plural}. For each of the {n} tracks on the final album, \"\n f\"they must choose exactly one {first_singular} and exactly one {second_singular}. If the \"\n f\"choices are made independently and uniformly at random for each track, what is the probability \"\n f\"that the exact same pairing of {first_singular} and {second_singular} is used for all {n} \"\n f\"album tracks?\"\n )\n\n lines = [\n f\"Total possible pairings per track: {first_count} * {second_count} = {p}\",\n f\"Total possible sequences for {n} tracks: {p}^{n}\",\n f\"Favorable sequences (all {n} tracks identical): {p}\",\n f\"Probability: {p} / {p}^{n}\",\n ]\n\n if exp == 1:\n simplified = f\"1 / {p}\"\n answer = f\"1/{p}\"\n else:\n simplified = f\"1 / {p}^{exp}\"\n answer = f\"1/{p}^{exp}\"\n\n lines.append(simplified)\n return question, lines, answer\n"}
|
| 2 |
+
{"tid": "5504e64673", "cat": "science_calc", "code": "def make(rng, original=False):\n if original:\n question = (\"A radioactive isotope used in tracing cellular metabolism has a half-life of $12 \\\\, \\\\text{hours}$. \"\n \"A sample initially contains $1.0 \\\\times 10^9$ atoms. After $48 \\\\, \\\\text{hours}$, \"\n \"how many decay events have occurred? Report the number of decays as an integer.\")\n h = 12\n t = 48\n k = t // h\n n0 = 1_000_000_000\n rem = n0 // (1 << k)\n lines = [\n f\"{t} / {h} = {k}\",\n f\"(1/2)^{k} = 1/{1 << k}\",\n f\"1.0 \u00d7 10^9 \u00d7 (1/{1 << k}) = {rem:,}\",\n f\"{n0:,} - {rem:,} = {n0 - rem:,}\",\n ]\n return question, lines, str(n0 - rem)\n\n contexts = [\n \"measuring groundwater flow\",\n \"diagnosing thyroid function\",\n \"studying protein synthesis\",\n \"monitoring environmental contamination\",\n \"tracing chemical reactions\",\n ]\n objects = [\n \"A vial of a radiotracer\",\n \"A batch of a radioactive tracer\",\n \"A specimen of a radiolabel\",\n \"A sample of a radioactive isotope\",\n ]\n units = [\"hours\", \"days\", \"minutes\"]\n\n for _ in range(100):\n k = rng.randint(3, 5)\n e = rng.randint(6, 9)\n m = rng.randint(1, 9)\n n0 = m * 10 ** e\n if n0 % (1 << k) != 0:\n continue\n\n unit = rng.choice(units)\n h = rng.randint(2, 12)\n t = h * k\n\n if h == 12 and unit == \"hours\" and m == 1 and e == 9 and k == 4:\n continue\n\n context = rng.choice(contexts)\n obj = rng.choice(objects)\n\n rem = n0 // (1 << k)\n decays = n0 - rem\n if decays <= 0:\n continue\n\n n0_str = f\"{m}.0 \u00d7 10^{e}\"\n question = (f\"{obj} used in {context} has a half-life of {h} {unit}. \"\n f\"It initially contains {n0_str} atoms. After {t} {unit}, \"\n f\"how many decay events have occurred? Report the number of decays as an integer.\")\n lines = [\n f\"{t} / {h} = {k}\",\n f\"(1/2)^{k} = 1/{1 << k}\",\n f\"{n0_str} \u00d7 (1/{1 << k}) = {rem:,}\",\n f\"{n0:,} - {rem:,} = {decays:,}\",\n ]\n return question, lines, str(decays)\n\n return None\n"}
|
| 3 |
+
{"tid": "bd6e44c2e3", "cat": "finance", "code": "def make(rng, original=False):\n if original:\n P, rate, t = 20000, 5, 3\n annual = P * rate // 100\n interest = annual * t\n question = (\"An individual takes out a $20,000 personal loan with a 5% annual simple interest rate \"\n \"to fund a collection of antique hardware. If the loan is repaid in a single lump sum \"\n \"after 3 years, what is the total amount of interest paid?\")\n lines = [\n f\"Principal P = {P}\",\n f\"Annual rate r = {rate / 100:.2f}\",\n f\"Time t = {t}\",\n \"Interest I = P r t\",\n f\"I = {P} * {rate / 100:.2f} * {t}\",\n f\"I = {annual} * {t}\",\n f\"I = {interest}\",\n ]\n return question, lines, f\"${interest:,}\"\n\n names = [\"Maya\", \"Leo\", \"Ava\", \"Noah\", \"Zoe\", \"Sam\"]\n roles = [\"collector\", \"restorer\", \"hobbyist\", \"shop owner\", \"curator\"]\n purposes = [\"a set of vintage tools\", \"a collection of antique hardware\", \"a batch of rare coins\",\n \"a set of classic cameras\", \"a group of old maps\"]\n loan_types = [\"personal loan\", \"small business loan\", \"equipment loan\", \"collection loan\"]\n\n P = rng.randrange(10, 1001) * 100\n rate = rng.randint(1, 15)\n t = rng.randint(1, 10)\n if P <= 0 or rate <= 0 or t <= 0:\n return None\n\n annual = P * rate // 100\n interest = annual * t\n if interest <= 0 or (P * rate * t) % 100 != 0:\n return None\n\n subject = f\"{rng.choice(names)}, a {rng.choice(roles)}\"\n purpose = rng.choice(purposes)\n loan_type = rng.choice(loan_types)\n template = rng.choice([\n \"{subject} takes out a ${P:,} {loan_type} with a {rate}% annual simple interest rate to fund {purpose}. If the loan is repaid in a single lump sum after {t} years, what is the total amount of interest paid?\",\n \"To fund {purpose}, {subject} borrows ${P:,} on a {loan_type} carrying {rate}% annual simple interest. The loan is repaid as a single lump sum after {t} years. How much interest is paid in total?\",\n \"A {loan_type} of ${P:,} is taken out by {subject} to fund {purpose}. The annual simple interest rate is {rate}%. After {t} years the loan is repaid in one lump sum. What is the total interest paid?\",\n ])\n question = template.format(subject=subject, P=P, loan_type=loan_type, rate=rate, purpose=purpose, t=t)\n\n lines = [\n f\"Principal P = {P}\",\n f\"Annual rate r = {rate / 100:.2f}\",\n f\"Time t = {t} years\",\n \"Interest I = P * r * t\",\n f\"I = {P} * {rate / 100:.2f} * {t}\",\n f\"I = {annual} * {t}\",\n f\"I = {interest}\",\n ]\n return question, lines, f\"${interest:,}\"\n"}
|
| 4 |
+
{"tid": "28d63f27d5", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n question = (\n \"A historian is organizing a timeline of Henry Edward Landor Thuillier's potential correspondence. \"\n \"He has 120 letters to sort. He sorts 15 letters in the first hour. \"\n \"For the next two hours, he sorts letters at a rate of 20% faster than his initial hourly rate. \"\n \"How many letters remain to be sorted after these three hours?\"\n )\n lines = [\n \"Initial hourly rate = 15 letters/hour\",\n \"Rate for next two hours = 15 + 0.20(15)\",\n \"Rate for next two hours = 15 + 3\",\n \"Rate for next two hours = 18 letters/hour\",\n \"Letters sorted in next two hours = 18 \u00d7 2\",\n \"Letters sorted in next two hours = 36\",\n \"Total letters sorted = 15 + 36\",\n \"Total letters sorted = 51\",\n \"Letters remaining = 120 - 51\",\n \"Letters remaining = 69\",\n ]\n return question, lines, \"69\"\n\n names = [\"Dr. Ada\", \"Prof. Ben\", \"Ms. Chen\", \"Mr. Diaz\", \"Dr. Elena\", \"Prof. Farah\"]\n roles = [\"historian\", \"librarian\", \"archivist\", \"curator\", \"researcher\"]\n objects = [\"letters\", \"manuscripts\", \"postcards\", \"photographs\", \"documents\", \"records\"]\n actions = [\"sort\", \"catalog\", \"file\", \"scan\", \"index\"]\n forms = {\n \"sort\": (\"sorts\", \"sorted\"),\n \"catalog\": (\"catalogs\", \"cataloged\"),\n \"file\": (\"files\", \"filed\"),\n \"scan\": (\"scans\", \"scanned\"),\n \"index\": (\"indexes\", \"indexed\"),\n }\n\n def word(n):\n return {1: \"one\", 2: \"two\", 3: \"three\", 4: \"four\"}[n]\n\n for _ in range(1000):\n percent = rng.choice([10, 20, 25, 50])\n candidates = [n for n in range(8, 26) if (n * percent) % 100 == 0]\n if not candidates:\n continue\n\n first = rng.choice(candidates)\n hours2 = rng.randint(1, 3)\n increase = first * percent // 100\n rate2 = first + increase\n sorted2 = rate2 * hours2\n total_sorted = first + sorted2\n\n remaining = rng.randint(10, 100)\n total = total_sorted + remaining\n if total < 80 or total > 200:\n continue\n break\n else:\n return None\n\n name = rng.choice(names)\n role = rng.choice(roles)\n obj = rng.choice(objects)\n action = rng.choice(actions)\n action_s, past = forms[action]\n\n h2 = \"hour\" if hours2 == 1 else f\"{word(hours2)} hours\"\n th = f\"{word(1 + hours2)} hours\"\n\n if rng.random() < 0.5:\n question = (\n f\"{name}, a {role}, is organizing {obj}. \"\n f\"{name} has {total} {obj} to {action}. \"\n f\"{name} {action_s} {first} {obj} in the first hour. \"\n f\"For the next {h2}, {name} {action_s} {obj} at a rate of {percent}% faster than the initial hourly rate. \"\n f\"How many {obj} remain to be {past} after these {th}?\"\n )\n else:\n question = (\n f\"{name}, a {role}, is organizing {obj}. \"\n f\"{name} {action_s} {first} {obj} in the first hour. \"\n f\"{name} has {total} {obj} to {action}. \"\n f\"For the next {h2}, {name} {action_s} {obj} at a rate of {percent}% faster than the initial hourly rate. \"\n f\"How many {obj} remain to be {past} after these {th}?\"\n )\n\n lines = [\n f\"Initial hourly rate = {first} {obj}/hour\",\n f\"Rate for next {h2} = {first} + {percent / 100:.2f}({first})\",\n f\"Rate for next {h2} = {first} + {increase}\",\n f\"Rate for next {h2} = {rate2} {obj}/hour\",\n f\"{obj.capitalize()} {past} in next {h2} = {rate2} \u00d7 {hours2}\",\n f\"{obj.capitalize()} {past} in next {h2} = {sorted2}\",\n f\"Total {obj} {past} = {first} + {sorted2}\",\n f\"Total {obj} {past} = {total_sorted}\",\n f\"{obj.capitalize()} remaining = {total} - {total_sorted}\",\n f\"{obj.capitalize()} remaining = {remaining}\",\n ]\n\n return question, lines, str(remaining)\n"}
|
| 5 |
+
{"tid": "621bc68462", "cat": "finance", "code": "import math\n\ndef make(rng, original=False):\n if original:\n fixed = 1_200_000\n var = 450\n price = 950\n cm = price - var\n be = math.ceil(fixed / cm)\n question = (\n 'The \"Childers Construction Co.\" has a fixed cost of $1,200,000 per year '\n 'and a variable cost of $450 per unit of output. If the company sells each '\n 'unit for $950, calculate the break-even quantity in units. Round up to the '\n 'nearest whole unit.'\n )\n lines = [\n f'Contribution margin per unit = {price} - {var} = {cm}',\n f'Break-even quantity = {fixed:,} / {cm} = {be}',\n f'Round up to the nearest whole unit = {be}',\n ]\n return question, lines, str(be)\n\n names = [\n 'Acme Fabrication Co.', 'Brightline Logistics LLC', 'Cedar Valley Manufacturing',\n 'Delta Precision Works', 'Evergreen Assembly Inc.', 'Falcon Ridge Industries',\n 'Granite Peak Supply', 'Harbor Lane Productions', 'Ironwood Components',\n 'Juniper Field Services',\n ]\n industries = ['construction', 'manufacturing', 'logistics', 'assembly', 'supply']\n\n name = rng.choice(names)\n industry = rng.choice(industries)\n units = rng.randint(1_000, 25_000)\n contribution = rng.randint(100, 1_500)\n var = rng.randint(50, 900)\n price = var + contribution\n fixed = units * contribution\n\n if contribution <= 0 or price <= var or fixed <= 0:\n return None\n if fixed % contribution != 0:\n return None\n if (name, fixed, var, price) == ('Childers Construction Co.', 1_200_000, 450, 950):\n return None\n\n templates = [\n 'The \"{name}\" has a fixed cost of ${fixed:,} per year and a variable cost of ${var} per unit of output. If the company sells each unit for ${price}, calculate the break-even quantity in units. Round up to the nearest whole unit.',\n 'The {industry} company \"{name}\" has fixed costs of ${fixed:,} per year and variable costs of ${var} per unit. Each unit is sold for ${price}. What is the break-even quantity in units? Round up to the nearest whole unit.',\n 'For \"{name}\", annual fixed costs are ${fixed:,} and variable costs are ${var} per unit. The selling price is ${price} per unit. Determine the break-even quantity in units, rounded up to the nearest whole unit.',\n ]\n question = rng.choice(templates).format(name=name, fixed=fixed, var=var, price=price, industry=industry)\n\n cm = price - var\n be = math.ceil(fixed / cm)\n lines = [\n f'Contribution margin per unit = {price} - {var} = {cm}',\n f'Break-even quantity = {fixed:,} / {cm} = {be}',\n f'Round up to the nearest whole unit = {be}',\n ]\n return question, lines, str(be)\n"}
|
| 6 |
+
{"tid": "2517d48c47", "cat": "planning", "code": "def make(rng, original=False):\n if original:\n total = 1200\n crates = 40\n per = total // crates\n question = (\n 'A logistics manager must pack 1,200 commemorative \"2007 AFL Grand Final\" '\n \"tickets into 40 identical crates. Each crate must contain the same integer \"\n \"number of tickets, and no crate may be left empty. What is the maximum number \"\n \"of tickets that can be placed in a single crate?\"\n )\n lines = [\n f\"Total tickets = {total}\",\n f\"Number of crates = {crates}\",\n \"Each crate contains the same integer number of tickets\",\n \"No crate is empty\",\n \"Let x be the number of tickets per crate\",\n f\"{crates}x = {total}\",\n f\"x = {total} / {crates}\",\n f\"x = {per}\",\n f\"Maximum number of tickets in a single crate = {per}\",\n ]\n return question, lines, str(per)\n\n names = [\"Maria\", \"James\", \"Aisha\", \"Leo\", \"Nora\", \"Owen\"]\n titles = [\n \"logistics manager\",\n \"warehouse worker\",\n \"storekeeper\",\n \"librarian\",\n \"coin collector\",\n \"museum curator\",\n ]\n verbs = [\"must pack\", \"needs to pack\", \"has to pack\"]\n items = [\n (\"tickets\", \"crate\", \"crates\"),\n (\"apples\", \"bin\", \"bins\"),\n (\"books\", \"box\", \"boxes\"),\n (\"coins\", \"bag\", \"bags\"),\n (\"pennies\", \"jar\", \"jars\"),\n (\"postcards\", \"folder\", \"folders\"),\n ]\n\n for _ in range(20):\n name = rng.choice(names)\n title = rng.choice(titles)\n role = f\"{name}, a {title},\"\n verb = rng.choice(verbs)\n obj, cont_s, cont_p = rng.choice(items)\n crates = rng.randint(10, 120)\n per = rng.randint(10, 120)\n total = crates * per\n if total % crates != 0:\n continue\n if total < 100 or per < 10 or crates < 10:\n continue\n if total == 1200 and crates == 40:\n continue\n break\n else:\n return None\n\n condition = rng.choice([\n f\"Each {cont_s} must contain the same integer number of {obj}, and no {cont_s} may be left empty.\",\n f\"No {cont_s} may be left empty, and each {cont_s} must contain the same integer number of {obj}.\",\n ])\n\n question = (\n f\"{role} {verb} {total:,} {obj} into {crates} identical {cont_p}. \"\n f\"{condition} What is the maximum number of {obj} that can be placed in a single {cont_s}?\"\n )\n\n lines = [\n f\"Total {obj} = {total}\",\n f\"Number of {cont_p} = {crates}\",\n f\"Each {cont_s} contains the same integer number of {obj}\",\n f\"No {cont_s} is empty\",\n f\"Let x be the number of {obj} per {cont_s}\",\n f\"{crates}x = {total}\",\n f\"x = {total} / {crates}\",\n f\"x = {per}\",\n f\"Maximum number of {obj} in a single {cont_s} = {per}\",\n ]\n\n return question, lines, str(per)\n"}
|
| 7 |
+
{"tid": "5c3acd8d0a", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n y1, y2, p = 1762, 1791, 5\n d = y2 - y1\n tenths = (d * 10) // p\n answer = f\"{tenths // 10}.{tenths % 10}\"\n question = (\n \"In a timeline, B\u00e9dard\u2019s birth year (1762) is placed 5 positions \"\n \"to the left of the year he became a lawyer (1791). If each position \"\n \"represents an equal number of years, how many years does each position represent?\"\n )\n lines = [\n f\"{y2} \u2013 {y1} = {d} years\",\n f\"{d} years \u00f7 {p} positions = {answer} years per position\",\n ]\n return question, lines, answer\n\n names = [\n \"Lafontaine\", \"Moreau\", \"Gagnon\", \"Tremblay\", \"Pelletier\",\n \"C\u00f4t\u00e9\", \"B\u00e9langer\", \"Charbonneau\", \"Lacroix\", \"Dubois\",\n ]\n firsts = [\"birth\", \"baptism\", \"arrival\", \"first marriage\"]\n seconds = [\n \"became a lawyer\", \"became a notary\", \"became a priest\",\n \"arrived in the colony\", \"had his first child\",\n \"married for the second time\",\n ]\n templates = [\n \"In a timeline, {name}'s {first} year ({y1}) is placed {p} positions to the left of the year he {second} ({y2}). If each position represents an equal number of years, how many years does each position represent?\",\n \"A timeline shows {name}'s {first} year ({y1}) {p} positions to the left of the year he {second} ({y2}). If all positions are equally spaced in years, how many years does one position represent?\",\n \"On a timeline, the year of {name}'s {first} ({y1}) appears {p} positions before the year he {second} ({y2}). If the spacing is uniform, what is the number of years per position?\",\n ]\n\n for _ in range(1000):\n p = rng.randint(2, 9)\n d = rng.randint(20, 120)\n\n if d % p == 0:\n continue\n if (d * 10) % p != 0:\n continue\n\n tenths = (d * 10) // p\n if tenths < 30 or tenths > 120:\n continue\n\n y1 = rng.randint(1500, 1999 - d)\n y2 = y1 + d\n\n name = rng.choice(names)\n first = rng.choice(firsts)\n second = rng.choice(seconds)\n\n if first == \"birth\" and second == \"became a lawyer\":\n continue\n if first == \"arrival\" and second == \"arrived in the colony\":\n continue\n\n question = rng.choice(templates).format(\n name=name,\n first=first,\n y1=y1,\n p=p,\n second=second,\n y2=y2,\n )\n answer = f\"{tenths // 10}.{tenths % 10}\"\n lines = [\n f\"{y2} \u2013 {y1} = {d} years\",\n f\"{d} years \u00f7 {p} positions = {answer} years per position\",\n ]\n return question, lines, answer\n\n return None\n"}
|
| 8 |
+
{"tid": "32043b7a61", "cat": "science_calc", "code": "def make(rng, original=False):\n if original:\n question = r\"In a biological study of auditory sensitivity, a specific strain of *Drosophila* flies exhibits a mutation that reduces their ability to detect sound frequencies above 8 kHz. If the threshold intensity for hearing 8 kHz sound in this strain is $1.0 \\times 10^{-9} \\, \\text{W/m}^2$, and the standard reference intensity for human hearing is $I_0 = 1.0 \\times 10^{-12} \\, \\text{W/m}^2$, calculate the sound level in decibels (dB) corresponding to this threshold. Use the formula $\\beta = 10 \\log_{10}(I/I_0)$ and round to the nearest whole number.\"\n eI = -9\n e0 = -12\n diff = eI - e0\n beta = round(10 * diff)\n lines = [\n f\"I / I0 = (1.0 \u00d7 10^{eI}) / (1.0 \u00d7 10^{e0})\",\n f\"I / I0 = 10^{diff}\",\n f\"log10(10^{diff}) = {diff}\",\n f\"\u03b2 = 10 \u00d7 {diff}\",\n f\"\u03b2 = {beta}\",\n ]\n return question, lines, f\"{beta} dB\"\n\n coeff = rng.choice([1, 2, 5])\n e0 = rng.randint(-13, -11)\n diff = rng.randint(2, 6)\n if coeff == 1 and e0 == -12 and diff == 3:\n return None\n eI = e0 + diff\n\n freq = rng.choice([1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])\n organism = rng.choice([\"Mus musculus\", \"Rattus norvegicus\", \"Gallus gallus\", \"Anolis carolinensis\", \"Drosophila melanogaster\"])\n strain = rng.choice([\"mutant\", \"laboratory\", \"experimental\", \"transgenic\"])\n phrase = rng.choice([\n \"exhibits a mutation that reduces their ability to detect\",\n \"shows a mutation that lowers detection of\",\n \"has a mutation that impairs detection of\",\n ])\n calc = rng.choice([\"calculate\", \"find\", \"determine\"]).capitalize()\n\n I_str = f\"{coeff}.0 \u00d7 10^{eI}\"\n I0_str = f\"{coeff}.0 \u00d7 10^{e0}\"\n\n if rng.random() < 0.5:\n question = (\n f\"In a biological study of auditory sensitivity, a {strain} strain of {organism} {phrase} sound frequencies above {freq} kHz. \"\n f\"If the threshold intensity for hearing {freq} kHz sound in this strain is {I_str} W/m^2, and the reference intensity is I0 = {I0_str} W/m^2, \"\n f\"{calc} the sound level in decibels (dB) corresponding to this threshold. Use the formula \u03b2 = 10 log10(I/I0) and round to the nearest whole number.\"\n )\n else:\n question = (\n f\"In a biological study of auditory sensitivity, a {strain} strain of {organism} {phrase} sound frequencies above {freq} kHz. \"\n f\"If the reference intensity is I0 = {I0_str} W/m^2, and the threshold intensity for hearing {freq} kHz sound in this strain is {I_str} W/m^2, \"\n f\"{calc} the sound level in decibels (dB) corresponding to this threshold. Use the formula \u03b2 = 10 log10(I/I0) and round to the nearest whole number.\"\n )\n\n beta = round(10 * diff)\n lines = [\n f\"I / I0 = ({I_str}) / ({I0_str})\",\n f\"I / I0 = 10^{diff}\",\n f\"log10(10^{diff}) = {diff}\",\n f\"\u03b2 = 10 \u00d7 {diff}\",\n f\"\u03b2 = {beta}\",\n ]\n return question, lines, f\"{beta} dB\"\n"}
|