# Khan/khan-exercises

Change "percent" answer type to interpret answer key as a decimal; ac…

…cept percent in independent_probability Fix #37553

Test Plan: Ran grep percent exercises/* | grep data-forms to find all exercises using the percent data-form and tested several questions of each such problem type

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D1046
1 parent 71001a7 commit 83ab06dc30c3c2c21a36cf6b25d175f2ee89a3be beneater committed Jan 21, 2013
 @@ -15,7 +15,7 @@

Express the decimal as a percent.

DECIMAL

-

PERCENT

+

DECIMAL

Rewrite the decimal as a fraction with a denominator of 100.

 @@ -51,7 +51,7 @@ roundTo( 1, MEAN + STDDEV * Z ) years.

-
+

We can try to estimate using the empirical rule, also known as the 68-95-99.7 percent rule.

@@ -396,7 +396,7 @@ roundTo( 1, MEAN + STDDEV * Z1 ) and roundTo( 1, MEAN + STDDEV * Z2 ) years.

-
AREA
+
AREA / 100
 @@ -41,7 +41,7 @@ If you flip a coin and roll a 6-sided die, what is the probability that you will flip a HT and roll RESULT_DESC?

-
0.5 * RESULT_POSSIBLE.length / 6
+
0.5 * RESULT_POSSIBLE.length / 6

@@ -408,7 +408,7 @@ If both fire their cannons at the same time, what is the probability that QUESTION?

-
+

 @@ -42,7 +42,7 @@

person(1) has BANK_MORE dollars in the bank today. Yesterday, he(1) had BANK_FEWER dollars in the bank. By what percentage did person(1)'s bank account increase over the past day? (Round your answer to the nearest hundredth of a percent.)

-

round(((BANK_MORE - BANK_FEWER) * 10000) / BANK_FEWER) / 100

+

roundTo(4, (BANK_MORE - BANK_FEWER) / BANK_FEWER)

The bank account grew by BANK_MORE - BANK_FEWER = BANK_MORE - BANK_FEWER dollars

\frac{BANK_MORE - BANK_FEWER}{BANK_FEWER} \approx round(((BANK_MORE - BANK_FEWER) * 10000) / BANK_FEWER) / 100\%

@@ -51,7 +51,7 @@

person(1) has BANK_FEWER dollars in the bank today. Yesterday, he(1) had BANK_MORE dollars in the bank. By what percentage did person(1)'s bank account decrease over the past day? (Round your answer to the nearest hundredth of a percent.)

-

round(((BANK_MORE - BANK_FEWER) * 10000) / BANK_MORE) / 100

+

roundTo(4, (BANK_MORE - BANK_FEWER) / BANK_MORE)

The bank account decreased by BANK_MORE - BANK_FEWER = BANK_MORE - BANK_FEWER dollars

\frac{BANK_MORE - BANK_FEWER}{BANK_MORE} \approx round(((BANK_MORE - BANK_FEWER) * 10000) / BANK_MORE) / 100\%

 @@ -69,8 +69,8 @@
rowzgrid
-
- roundTo(2, ANSWER * 100) +
 @@ -211,6 +211,15 @@ Khan.answerTypes = $.extend(Khan.answerTypes, { },$(solution).data()); var acceptableForms = options.forms.split(/\s*,\s*/); + // If percent is an acceptable form, make sure it's the last one + // in the list so we don't prematurely complain about not having + // a percent sign when the user entered the correct answer in a + // different form (such as a decimal or fraction) + if (_.contains(acceptableForms, "percent")) { + acceptableForms = _.without(acceptableForms, "percent"); + acceptableForms.push("percent"); + } + // Take text looking like a fraction, and turn it into a number var fractionTransformer = function(text) { text = text @@ -374,6 +383,7 @@ Khan.answerTypes = $.extend(Khan.answerTypes, { var transformed = forms.decimal(text);$.each(transformed, function(ix, t) { t.exact = hasPercentSign; + t.value = t.value / 100; }); return transformed; },