fix(curriculum): spaces inside parenthesis (#53480)

This commit is contained in:
Krzysztof G
2024-02-02 11:26:21 +01:00
committed by GitHub
parent 8eb1c0d3f4
commit c8311eb506
320 changed files with 630 additions and 630 deletions
@@ -28,7 +28,7 @@ You should print the provided string inside your new `for` loop.
({ test: () => {
const shortest = __helpers.python.getDef(code, "shortest_path");
const {function_body} = shortest;
assert(function_body.match(/^(\s{4})for\s+node\s+in\s+targets_to_print\s*:\s*^\1\1print\s*\(f("|')\\n\{\s*start\s*\}-\{\s*node\s*\}\sdistance:\s\{\s*distances\s*\[\s*node\s*\]\s*\}\\nPath:\s\{\s*(?=[^\1])("|')\s->\s\3\.join\s*\(\s*paths\s*\[\s*node\s*\]\s*\)\s*\}\2\s*\)/ms));
assert(function_body.match(/^(\s{4})for\s+node\s+in\s+targets_to_print\s*:\s*^\1\1print\s*\(\s*f("|')\\n\{\s*start\s*\}-\{\s*node\s*\}\sdistance:\s\{\s*distances\s*\[\s*node\s*\]\s*\}\\nPath:\s\{\s*(?=[^\1])("|')\s->\s\3\.join\s*\(\s*paths\s*\[\s*node\s*\]\s*\)\s*\}\2\s*\)/ms));
}
})
```
@@ -32,7 +32,7 @@ You should create a variable called `targets_to_print` after your `while` loop.
({ test: () => {
const shortest = __helpers.python.getDef(code, "shortest_path");
const {function_body} = shortest;
assert(function_body.match(/unvisited\.remove\(current\).*^\s{4}targets_to_print\s*=/ms));
assert(function_body.match(/unvisited\.remove\(\s*current\s*\).*^\s{4}targets_to_print\s*=/ms));
}
})
```
@@ -43,7 +43,7 @@ You should the ternary syntax to assign `[target]` when `target` is truthy, and
({ test: () => {
const shortest = __helpers.python.getDef(code, "shortest_path");
const {function_body} = shortest;
assert(function_body.match(/unvisited\.remove\(current\).*^\s{4}targets_to_print\s*=\s*\[\s*target\s*\]\s+if\s+target\s+else\s+graph/ms));
assert(function_body.match(/unvisited\.remove\(\s*current\s*\).*^\s{4}targets_to_print\s*=\s*\[\s*target\s*\]\s+if\s+target\s+else\s+graph/ms));
}
})
```
@@ -24,8 +24,8 @@ Create an `__init__` method inside your `Board` class.
Your method should be named `__init__`. Don't add any parameters.
```js
assert.match(code, / +def\s+__init__\s*\(\)\:/);
```
assert.match(code, / +def\s+__init__\s*\(\s*\)\:/);
```
# --seed--
@@ -14,13 +14,13 @@ In the `try` block, attempt to find the index of the first occurrence of `0` in
Use the index of the first occurrence of `0` in the current row using `contents.index(0)`.
```js
assert.match(code, /contents\.index\(0\)/)
assert.match(code, /contents\.index\(\s*0\s*\)/)
```
You should have `col = contents.index(0)` within the `try` block.
```js
assert.match(code, /col\s*=\s*contents\.index\(0\)/)
assert.match(code, /col\s*=\s*contents\.index\(\s*0\s*\)/)
```
# --seed--
@@ -22,7 +22,7 @@ You should assign the result of `(row // 3) * 3` to `row_start`.
const tCode = code.replace(/\r/g, '');
const valid = __helpers.python.getDef(tCode, "valid_in_square");
const {function_body} = valid;
assert.match(function_body, /row_start\s*=\s*\(row\s*\/\/\s*3\)\s*\*\s*3/);
assert.match(function_body, /row_start\s*=\s*\(\s*row\s*\/\/\s*3\s*\)\s*\*\s*3/);
```
# --seed--
@@ -22,7 +22,7 @@ You should assign the result of `(col // 3) * 3` to `col_start`.
const tCode = code.replace(/\r/g, '');
const valid = __helpers.python.getDef(tCode, "valid_in_square");
const {function_body} = valid;
assert.match(function_body, /col_start\s*=\s*\(col\s*\/\/\s*3\)\s*\*\s*3/);
assert.match(function_body, /col_start\s*=\s*\(\s*col\s*\/\/\s*3\s*\)\s*\*\s*3/);
```
# --seed--
@@ -22,7 +22,7 @@ You should have `next_empty := self.find_empty_cell()` within the `solver` metho
```js
const tCode = code.replace(/\r/g, '');
const {function_body} = __helpers.python.getDef(tCode, "solver");
assert.match(function_body, /next_empty\s*:=\s*self\.find_empty_cell\(\)/);
assert.match(function_body, /next_empty\s*:=\s*self\.find_empty_cell\(\s*\)/);
```
# --seed--
@@ -16,7 +16,7 @@ You should have `if (next_empty := self.find_empty_cell()) is None:` withing `so
```js
const tCode = code.replace(/\r/g, '');
const {function_body} = __helpers.python.getDef(tCode, "solver");
assert.match(function_body, /if\s*\(next_empty\s*:=\s*self\.find_empty_cell\(\)\)\s*is\s*None:/)
assert.match(function_body, /if\s*\(\s*next_empty\s*:=\s*self\.find_empty_cell\(\s*\)\s*\)\s*is\s*None:/)
```
# --seed--
@@ -17,7 +17,7 @@ You should have `for guess in range(1,10):` within the `else` block.
const tCode = code.replace(/\r/g, '');
const {function_body} = __helpers.python.getDef(tCode, "solver");
const {block_body} = __helpers.python.getBlock(function_body, "else");
assert.match(block_body, /for\s+\w+\s+in\s+range\(1,\s*10\)/);
assert.match(block_body, /for\s+\w+\s+in\s+range\(\s*1,\s*10\s*\)/);
```
# --seed--
@@ -17,7 +17,7 @@ You should have `self.solver()` within the innermost `if` block.
const tCode = code.replace(/\r/g, '');
const {function_body} = __helpers.python.getDef(tCode, "solver");
const {block_body} = __helpers.python.getBlock(function_body, "if self.is_valid(next_empty, guess)");
assert.match(block_body, /self\.solver\(\)/);
assert.match(block_body, /self\.solver\(\s*\)/);
```
# --seed--
@@ -19,7 +19,7 @@ You should have `if self.solver():` within the innermost `if` block.
const tCode = code.replace(/\r/g, '');
const {function_body} = __helpers.python.getDef(tCode, "solver");
const {block_body} = __helpers.python.getBlock(function_body, "if self.is_valid(next_empty, guess)");
assert.match(block_body, /if\s+self\.solver\(\):/);
assert.match(block_body, /if\s+self\.solver\(\s*\):/);
```
You should have `return True` within `if self.solver():`.
@@ -18,7 +18,7 @@ You should have `gameboard = Board(board)` within the `solve_sudoku` function.
```js
const tCode = code.replace(/\r/g, '');
const {function_body} = __helpers.python.getDef(tCode, "solve_sudoku");
assert.match(function_body, /gameboard\s*=\s*Board\(board\)/);
assert.match(function_body, /gameboard\s*=\s*Board\(\s*board\s*\)/);
```
# --seed--
@@ -22,7 +22,7 @@ With this, you are finished with building the sudoku solver!
Call the `solve_sudoku` method with `puzzle` as input.
```js
assert.match(code, /solve_sudoku\(puzzle\)/);
assert.match(code, /solve_sudoku\(\s*puzzle\s*\)/);
```
# --seed--
@@ -22,7 +22,7 @@ You should replace `pass` keyword with an `if` statement with this condition: `l
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*pass/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*pass/);
}
})
```
@@ -24,7 +24,7 @@ You should replace `pass` with `array[sorted_index] = left_part[left_array_index
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*array\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]\s*(?!.*\bpass\b)/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*array\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]\s*(?!.*\bpass\b)/);
}
})
```
@@ -24,7 +24,7 @@ Your `while` loop should have this condition: `left_array_index < len(left_part)
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /^\s{4}while\s+left_array_index\s*<\s*len\(left_part\):/m);
assert.match(function_body, /^\s{4}while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):/m);
}
})
```
@@ -38,7 +38,7 @@ You should have the `pass` keyword in the body of your `while` loop
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\bpass\b/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\bpass\b/);
}
})
```
@@ -20,7 +20,7 @@ You should have `array[sorted_index] = left_part[left_array_index]` in the body
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\barray\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\barray\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]/);
}
})
```
@@ -34,7 +34,7 @@ You should not have `pass` in the `while` loop.
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):(?:(?!\bpass\b)[^}])*\barray\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):(?:(?!\bpass\b)[^}])*\barray\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]/);
}
})
```
@@ -20,7 +20,7 @@ You should use the `+=` operator to increment the current value of `left_array_i
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\bleft_array_index\s*\+=\s*1\b/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\bleft_array_index\s*\+=\s*1\b/);
}
})
```
@@ -22,7 +22,7 @@ You should use the `+= ` operator to increment the current value of `sorted_inde
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\bsorted_index\s*\+=\s*1\b/);
assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\bsorted_index\s*\+=\s*1\b/);
}
})
```
@@ -22,7 +22,7 @@ Your `while` loop should have this condition: `right_array_index < len(right_par
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /^\s{4}while\s+right_array_index\s*<\s*len\(right_part\):/m);
assert.match(function_body, /^\s{4}while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):/m);
}
})
```
@@ -36,7 +36,7 @@ You should have the `pass` keyword in the body of your `while` loop
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\bpass\b/);
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\bpass\b/);
}
})
```
@@ -20,7 +20,7 @@ You should have `array[sorted_index] = right_part[right_array_index]` in the bod
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\barray\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/);
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\barray\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/);
}
})
```
@@ -34,7 +34,7 @@ There should be no `pass` keyword in the `while` loop
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):(?:(?!\bpass\b)[^}])*\barray\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/);
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):(?:(?!\bpass\b)[^}])*\barray\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/);
}
})
```
@@ -20,7 +20,7 @@ You should have `right_array_index += 1` within the `while` loop.
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\bright_array_index\s*\+=\s*1\b/);
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\bright_array_index\s*\+=\s*1\b/);
}
})
```
@@ -20,7 +20,7 @@ You should use the `+=` operator to increment the current value of `sorted_index
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\bsorted_index\s*\+=\s*1\b/);
assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\bsorted_index\s*\+=\s*1\b/);
}
})
```
@@ -24,7 +24,7 @@ You should create an `if` statement to check if `len(array) <= 1`. Don't forget
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /if\s+len\(array\)\s*<=\s*1:\s*pass/);
assert.match(function_body, /if\s+len\(\s*array\s*\)\s*<=\s*1:\s*pass/);
}
})
```
@@ -20,7 +20,7 @@ You should replace `pass` with a `return` statement in the body of the `if` stat
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /if\s+len\(array\)\s*<=\s*1:\s*return/);
assert.match(function_body, /if\s+len\(\s*array\s*\)\s*<=\s*1:\s*return/);
}
})
```
@@ -34,7 +34,7 @@ There should be no `pass` keyword in the body of the `if` statement
const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort");
const { function_body } = merge_sort;
assert.match(function_body, /if\s+len\(array\)\s*<=\s*1:\s*(?!.*\bpass\b).*return/);
assert.match(function_body, /if\s+len\(\s*array\s*\)\s*<=\s*1:\s*(?!.*\bpass\b).*return/);
}
})
```
@@ -21,8 +21,8 @@ You should add `1` to the current value of `left_array_index`.
const { function_body } = merge_sort;
const allowedMatches = [
/while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*left_array_index\s*\+=\s*1\s*(?!.*\bpass\b)/,
/while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*left_array_index\s*=\s*left_array_index\s*\+\s*1\s*(?!.*\bpass\b)/
/while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*left_array_index\s*\+=\s*1\s*(?!.*\bpass\b)/,
/while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*left_array_index\s*=\s*left_array_index\s*\+\s*1\s*(?!.*\bpass\b)/
]
const anyMatch = allowedMatches.some((match) => match.test(function_body));
@@ -27,7 +27,7 @@ You should have `sum_of_odd_digits += int(digit)` within the `for` loop.
const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number");
const { function_body } = verify_card_number;
assert.match(function_body, /sum_of_odd_digits\s*\+=\s*int\(digit\)/);
assert.match(function_body, /sum_of_odd_digits\s*\+=\s*int\(\s*digit\s*\)/);
}
})
```
@@ -22,7 +22,7 @@ You should have `number = int(digit) * 2` within the `for` loop.
const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number");
const { function_body } = verify_card_number;
assert.match(function_body, /number\s*=\s*int\(digit\)\s*\*\s*2/);
assert.match(function_body, /number\s*=\s*int\(\s*digit\s*\)\s*\*\s*2/);
}
})
```
@@ -30,8 +30,8 @@ You should have `number = number // 10 + number % 10` within the `if` statement.
const verify_card_number = __helpers.python.getBlock("\n" + transformedCode, "if number >= 10");
const { block_body } = verify_card_number;
const allowedMatches = [
/number *= *\(?number *\/\/ *10\)? *\+ *\(?number *% *10/,
/number *= *\(?number *% *10\)? *\+ *\(?number *\/\/ *10/
/number *= *\(?\s*number *\/\/ *10\s*\)? *\+ *\(?\s*number *% *10/,
/number *= *\(?\s*number *% *10\s*\)? *\+ *\(?\s*number *\/\/ *10/
];
const someMatch = allowedMatches.some(allowedMatch => allowedMatch.test(block_body));
@@ -34,7 +34,7 @@ You should use the `.append()` method to add `char` to the `snake_cased_char_lis
const convert_to_snake_case = __helpers.python.getDef("\n" + transformedCode, "convert_to_snake_case");
const { function_body } = convert_to_snake_case;
assert.match(function_body, / +snake_cased_char_list.append\(char\)/);
assert.match(function_body, / +snake_cased_char_list.append\(\s*char\s*\)/);
}
})
```
@@ -24,7 +24,7 @@ You should change the input string from `aLongAndComplexString` to `IAmAPascalCa
const main = __helpers.python.getDef("\n" + transformedCode, "main");
const { function_body } = main;
assert.match(function_body, / +print\(convert_to_snake_case\('IAmAPascalCasedString'\)\)/);
assert.match(function_body, / +print\(\s*convert_to_snake_case\(\s*'IAmAPascalCasedString'\s*\)\s*\)/);
}
})
```
@@ -16,7 +16,7 @@ You should move the code nested inside the first `if` statement (except the firs
```js
({ test: () => {
assert.match(code, /def\s+make_allowed_move\(rod1, rod2\):\s+forward\s+=\s+False\s+if\s+not\s+rods\s*\[\s*target\s*\]\s*:\s+forward\s*=\s*True\s+elif\s+rods\s*\[\s*source\s*\]\s+and\s+rods\s*\[\s*source\s*\]\s*\[\s*-1\s*\]\s*<\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*:\s+forward\s*=\s*True\s+if\s+forward\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*source\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*source\s*\}\sto\s\{\s*target\s*\}'\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\)\s+else\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*source\s*\}'\s*\)\s+rods\s*\[\s*source\s*\]\s*\.append\(\s*rods\s*\[\s*target\s*\]\s*\.pop\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+print\(\s*rods\s*\)/);
assert.match(code, /def\s+make_allowed_move\(\s*rod1, rod2\s*\):\s+forward\s+=\s+False\s+if\s+not\s+rods\s*\[\s*target\s*\]\s*:\s+forward\s*=\s*True\s+elif\s+rods\s*\[\s*source\s*\]\s+and\s+rods\s*\[\s*source\s*\]\s*\[\s*-1\s*\]\s*<\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*:\s+forward\s*=\s*True\s+if\s+forward\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*source\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*source\s*\}\sto\s\{\s*target\s*\}'\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\)\s+else\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*source\s*\}'\s*\)\s+rods\s*\[\s*source\s*\]\s*\.append\(\s*rods\s*\[\s*target\s*\]\s*\.pop\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+print\(\s*rods\s*\)/);
}
})
```
@@ -48,17 +48,17 @@ def move(n, source, auxiliary, target):
if not rods[target]:
forward = True
elif rods[source] and rods[source][-1] < rods[target][-1]:
forward = True
forward = True
if forward:
print(f'Moving disk {rods[source][-1]} from {source} to {target}')
rods[target].append(rods[source].pop())
else:
print(f'Moving disk {rods[target][-1]} from {target} to {source}')
rods[source].append(rods[target].pop())
# display our progress
print(rods)
--fcc-editable-region--
--fcc-editable-region--
elif remainder == 2:
print(f'Move {i + 1} allowed between {source} and {auxiliary}')
elif remainder == 0:
@@ -21,7 +21,7 @@ You should delete the last three lines in your code.
({ test: () => {
assert.isFalse(/pattern\s*=\s*r("|')\\W\1/.test(code));
assert.isFalse(/quote\s*=\s*("|')_\1/.test(code));
assert.isFalse(/print\(re\.findall\(pattern, quote\)\)/.test(code));
assert.isFalse(/print\(\s*re\.findall\(\s*pattern, quote\s*\)\s*\)/.test(code));
}})
```
@@ -16,13 +16,13 @@ Delete `pass` and recursively call the `_insert` method on the left child of the
You should call the `self._insert` method passing `node.left` and `key` as the arguments.
```js
({ test: () => assert.match(code, /self\._insert\(node\.left,\s*key\)/) });
({ test: () => assert.match(code, /self\._insert\(\s*node\.left,\s*key\s*\)/) });
```
You should assign the result of your `self._insert()` call to the `left` attribute of the current node.
```js
({ test: () => assert.match(code, /node\.left\s*=\s*self\._insert\(node\.left,\s*key\)/) });
({ test: () => assert.match(code, /node\.left\s*=\s*self\._insert\(\s*node\.left,\s*key\s*\)/) });
```
# --seed--
@@ -14,13 +14,13 @@ Inside your `elif` clause, replace `pass` with a call to the `_insert` method on
You should call the `self._insert()` method passing `node.right` and `key` as the arguments.
```js
({ test: () => assert.match(code, /self\._insert\(node\.right,\s*key\)/) });
({ test: () => assert.match(code, /self\._insert\(\s*node\.right,\s*key\s*\)/) });
```
You should assign the result of your `self._insert()` call to the right attribute (`node.right`) of the current node.
```js
({ test: () => assert.match(code, /node\.right\s*=\s*self\._insert\(node\.right,\s*key\)/) });
({ test: () => assert.match(code, /node\.right\s*=\s*self\._insert\(\s*node\.right,\s*key\s*\)/) });
```
# --seed--
@@ -25,7 +25,7 @@ You should call the `_search` method within the `search` method.
You should call the `_search` method passing `self.root` and `key` as the arguments.
```js
({ test: () => assert.match(code, /self\._search\(self\.root,\s*key\)/) });
({ test: () => assert.match(code, /self\._search\(\s*self\.root,\s*key\s*\)/) });
```
# --seed--
@@ -14,7 +14,7 @@ Now, make the `search` method return the result of the `_search()` call.
You should prepend the `return` statement to your `_search()` call.
```js
({ test: () => assert.match(code, /return\s+self\._search\(self\.root,\s*key\)/) });
({ test: () => assert.match(code, /return\s+self\._search\(\s*self\.root,\s*key\s*\)/) });
```
# --seed--
@@ -22,8 +22,8 @@ assert.match(after_split, /if\s+key\s+<\s+node\.key/);
You should return `self._search(node.left, key)` from your new `if` block.
```js
({ test: () => assert.match(code, /return\s+self\._search\(node\.left,\s*key\)/) });
```js
({ test: () => assert.match(code, /return\s+self\._search\(\s*node\.left,\s*key\s*\)/) });
```
# --seed--
@@ -25,14 +25,14 @@ assert.match(after_split, /self\._search/);
You should pass two arguments to the call of the `_search` method: `node.right` and `key`.
```js
({ test: () => assert.match(code, /self\._search\(node\.right,\s*key\)/) });
({ test: () => assert.match(code, /self\._search\(\s*node\.right,\s*key\s*\)/) });
```
You should return the result of the `_search` method call.
```js
({
test: () => assert.match(code, /return\s+self\._search\(node\.right,\s*key\)/)
test: () => assert.match(code, /return\s+self\._search\(\s*node\.right,\s*key\s*\)/)
});
```
@@ -18,7 +18,7 @@ Within the `BinarySearchTree` class, define a `delete` method. It takes two para
You should define a `delete` method with two parameters: `self` and `key`. Remember to use `pass`.
```js
({ test: () => assert.match(code, /def\s+delete\(self,\s*key\)/) });
({ test: () => assert.match(code, /def\s+delete\(\s*self,\s*key\s*\)/) });
```
# --seed--
@@ -14,7 +14,7 @@ Inside the `delete` method, delete `pass` and call the private helper method `_d
Your `delete` method should call the `_delete` method with two arguments: `self.root` and `key`.
```js
({ test: () => assert.match(code, /self\._delete\(self\.root,\s*key\)/) });
({ test: () => assert.match(code, /self\._delete\(\s*self\.root,\s*key\s*\)/) });
```
# --seed--
@@ -16,7 +16,7 @@ To handle this case, assign the result of the `_delete` call to `self.root`.
You should assign the result of the `_delete()` call to `self.root`.
```js
({ test: () => assert.match(code, /self\.root\s*=\s*self\._delete\(self\.root,\s*key\)/) });
({ test: () => assert.match(code, /self\.root\s*=\s*self\._delete\(\s*self\.root,\s*key\s*\)/) });
```
# --seed--
@@ -14,7 +14,7 @@ Inside the `BinarySearchTree` class, define a new helper method called `_delete`
You should define the `_delete` method inside the `BinarySearchTree` class with the parameters `self`, `node` and `key`. Remember to use the `pass` keyword.
```js
assert.match(code, /def\s+_delete\(self,\s*node,\s*key\)/);
assert.match(code, /def\s+_delete\(\s*self,\s*node,\s*key\s*\)/);
```
# --seed--
@@ -14,13 +14,13 @@ Within the `if` block, replace `pass` with a call to the `_delete` method, passi
You should call the `_delete` method with `node.left` and the `key` as the arguments.
```js
assert.match(code, /self\._delete\(node\.left,\s*key\)/);
assert.match(code, /self\._delete\(\s*node\.left,\s*key\s*\)/);
```
You should assign the result of the `_delete()` call to the left child (`node.left`) of the current node.
```js
assert.match(code, /node\.left\s*=\s*self\._delete\(node\.left,\s*key\)/);
assert.match(code, /node\.left\s*=\s*self\._delete\(\s*node\.left,\s*key\s*\)/);
```
# --seed--
@@ -23,13 +23,13 @@ assert.match(after_split, /elif\s+key\s+>\s+node\.key/);
You should call the `_delete` method with `node.right` and `key` as the arguments.
```js
assert.match(code, /self\._delete\(node\.right,\s*key\)/);
assert.match(code, /self\._delete\(\s*node\.right,\s*key\s*\)/);
```
You should assign the result of the `_delete()` call to `node.right`.
```js
assert.match(code, /node\.right\s*=\s*self\._delete\(node\.right,\s*key\)/);
assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right,\s*key\s*\)/);
```
# --seed--
@@ -21,7 +21,7 @@ For now, add a `_min_value` call after your `elif` block, passing `node.right` a
You should assign `self._min_value(node.right)` to `node.key` after your `elif` block.
```js
assert.match(code, /node\.key\s*=\s*self\._min_value\(node\.right\)/);
assert.match(code, /node\.key\s*=\s*self\._min_value\(\s*node\.right\s*\)/);
```
# --seed--
@@ -22,7 +22,7 @@ assert.match(code, /self\._delete\(\s*node\.right\s*,\s*node\.key\s*/);
You should assign the return value of the `_delete()` call to the right child of the current node.
```js
assert.match(code, /node\.right\s*=\s*self\._delete\(node\.right\,\s*node\.key/);
assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right\,\s*node\.key/);
```
# --seed--
@@ -16,7 +16,7 @@ This will start the traversal from the root of the binary search tree (`self.roo
You should call `_inorder_traversal` and pass `self.root` and `result` as the arguments.
```js
({ test: () => assert.match(code, /self\._inorder_traversal\(self\.root,\s*result\)/) })
({ test: () => assert.match(code, /self\._inorder_traversal\(\s*self\.root,\s*result\s*\)/) })
```
# --seed--
@@ -14,7 +14,7 @@ Define the `_inorder_traversal` method and give it three parameters: `self`, `no
You should define a method `_inorder_traversal` that takes three parameters: `self`, `node`, and `result`. Remember to use `pass`.
```js
assert.match(code, /def\s+_inorder_traversal\(self,\s*node,\s*result\)/);
assert.match(code, /def\s+_inorder_traversal\(\s*self,\s*node,\s*result\s*\)/);
```
# --seed--
@@ -20,7 +20,7 @@ assert.match(code, /if\s+node:/);
You should call `_inorder_traversal` on the `node.left` inside the `if` block.
```js
assert.match(code, /self\._inorder_traversal\(node\.left\s*,\s*result\s*\)/);
assert.match(code, /self\._inorder_traversal\(\s*node\.left\s*,\s*result\s*\)/);
```
# --seed--
@@ -14,7 +14,7 @@ Still inside the `if` block, append the `key` of the current node to the `result
You should append `node.key` to the `result` list.
```js
assert.match(code, /result\.append\(node\.key\)/);
assert.match(code, /result\.append\(\s*node\.key\s*\)/);
```
# --seed--
@@ -16,13 +16,13 @@ Create an instance of the `BinarySearchTree` class and assign it to the variable
You should create an instance of the `BinarySearchTree` class.
```js
assert.match(code, /BinarySearchTree\(\)/);
assert.match(code, /BinarySearchTree\(\s*\)/);
```
You should assign the new instance of `BinarySearchTree` to the variable `bst`.
```js
assert.match(code, /bst\s*=\s*BinarySearchTree\(\)/);
assert.match(code, /bst\s*=\s*BinarySearchTree\(\s*\)/);
```
# --seed--
@@ -16,7 +16,7 @@ This recursive call explores the entire right subtree in an in-order manner.
You should call `_inorder_traversal` passing `node.right` and `result` as the arguments.
```js
assert.match(code, /self\._inorder_traversal\(node\.right,\s*result\)/);
assert.match(code, /self\._inorder_traversal\(\s*node\.right,\s*result\s*\)/);
```
# --seed--
@@ -16,7 +16,7 @@ To change that to print a useful value, define another method named `__str__` in
You should define a method `__str__` that takes a single argument `self`. Remember to use `pass`.
```js
assert.match(code, /def\s+__str__\(self\)/);
assert.match(code, /def\s+__str__\(\s*self\s*\)/);
```
# --seed--
@@ -14,7 +14,7 @@ In the body of the `__str__` method, delete `pass` and return the result of call
You should return the string value of `self.key` from your `__str__` method.
```js
({ test: () => assert.match(code, /^\s{8}return\s+str\(self\.key\)/m) })
({ test: () => assert.match(code, /^\s{8}return\s+str\(\s*self\.key\s*\)/m) })
```
# --seed--
@@ -36,7 +36,7 @@ assert.match(code.toString(), /array\s*=\s*value\.split()/);
You should use `/,\s*/g` for the `split()` method's separator.
```js
assert.match(code.toString(), /value\.split\(\s*\/,\s*\\s*\*\s*\/g\)/);
assert.match(code.toString(), /value\.split\(\s*\/,\s*\\s*\*\s*\/g\s*\)/);
```
# --seed--
@@ -22,7 +22,7 @@ assert.match(calculate.toString(), /numbers/);
You should use the `.map()` method on your `array` variable.
```js
assert.match(calculate.toString(), /array\.map\(\)/);
assert.match(calculate.toString(), /array\.map\(\s*\)/);
```
You should assign the result of your `.map()` call to your `numbers` variable.
@@ -24,7 +24,7 @@ Add a callback function to your `.map()` method that converts each element to a
Your `.map()` method should have a callback function which takes an `el` parameter.
```js
assert.match(calculate.toString(), /array\.map\(\(?\s*el\s*\)?\s*=>|array\.map\(function\s*\(?el\)\s*\{/)
assert.match(calculate.toString(), /array\.map\(\s*(\(\s*el\s*\)|el)\s*=>|array\.map\(\s*function\s*\(\s*el\s*\)\s*\{/)
```
Your callback function should use the `Number` constructor to convert `el` to a number.
@@ -42,7 +42,7 @@ assert.notMatch(calculate.toString(), /new/);
Your callback function should return the element converted to a number.
```js
assert.match(calculate.toString(), /(array\.map\(\(?\s*el\s*\)?\s*=>|array\.map\(function\s*\(?el\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/);
assert.match(calculate.toString(), /(array\.map\(\s*(\(\s*el\s*\)|el)\s*=>|array\.map\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/);
```
# --seed--
@@ -24,13 +24,13 @@ assert.match(calculate.toString(), /filtered/);
Your `calculate` function should use the `.filter()` method on the `numbers` array.
```js
assert.match(calculate.toString(), /numbers\.filter\(\)/)
assert.match(calculate.toString(), /numbers\.filter\(\s*\)/)
```
You should assign the result of `numbers.filter()` to the `filtered` variable.
```js
assert.match(calculate.toString(), /filtered\s*=\s*numbers\.filter\(\)/);
assert.match(calculate.toString(), /filtered\s*=\s*numbers\.filter\(\s*\)/);
```
# --seed--
@@ -26,7 +26,7 @@ Add a callback function to your `.filter()` method that returns `true` if the el
Your `.filter()` method should have a callback which accepts `el` as a parameter.
```js
assert.match(calculate.toString(), /numbers\.filter\(\(?\s*el\s*\)?\s*=>|numbers\.filter\(function\s*\(?el\)\s*\{/)
assert.match(calculate.toString(), /numbers\.filter\(\s*(\(\s*el\s*\)|el)\s*=>|numbers\.filter\(\s*function\s*\(\s*el\s*\)\s*\{/)
```
Your callback function should use `!` and `isNaN()` to check if `el` is NOT `NaN`.
@@ -38,7 +38,7 @@ assert.match(calculate.toString(), /!\s*(Number\.)?isNaN\(\s*el\s*\)/);
Your callback function should return elements that are not `NaN`.
```js
assert.match(calculate.toString(), /(numbers\.filter\(\(?\s*el\s*\)?\s*=>|numbers\.filter\(function\s*\(?el\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/);
assert.match(calculate.toString(), /(numbers\.filter\(\s*(\(\s*el\s*\)|el)\s*=>|numbers\.filter\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/);
```
# --seed--
@@ -34,13 +34,13 @@ assert.match(calculate.toString(), /array\.map\(.*\)\.filter\(/s);
You should not remove the `.map()` callback.
```js
assert.match(calculate.toString(), /(array\.map\(\(?\s*el\s*\)?\s*=>|array\.map\(function\s*\(?el\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/);
assert.match(calculate.toString(), /(array\.map\(\s*(\(\s*el\s*\)|el)\s*=>|array\.map\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/);
```
You should not remove the `.filter()` callback.
```js
assert.match(calculate.toString(), /(\.filter\(\(?\s*el\s*\)?\s*=>|\.filter\(function\s*\(?el\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/s);
assert.match(calculate.toString(), /(\.filter\(\s*(\(\s*el\s*\)|el)\s*=>|\.filter\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/s);
```
# --seed--
@@ -22,13 +22,13 @@ assert.match(getMean.toString(), /sum/);
Your `getMean` function should use the `.reduce()` method of the `array` parameter.
```js
assert.match(getMean.toString(), /array\.reduce\(\)/);
assert.match(getMean.toString(), /array\.reduce\(\s*\)/);
```
You should assign the result of `array.reduce()` to the `sum` variable.
```js
assert.match(getMean.toString(), /sum\s*=\s*array\.reduce\(\)/);
assert.match(getMean.toString(), /sum\s*=\s*array\.reduce\(\s*\)/);
```
# --seed--
@@ -22,13 +22,13 @@ For your `sum` variable, pass a callback to `.reduce()` that takes the accumulat
Your `reduce` method should have a callback function which takes an `acc` and an `el` parameters.
```js
assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)/)
assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)/)
```
Your `reduce` method should return the sum of `acc` and `el`.
```js
assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el/)
assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el/)
```
# --seed--
@@ -22,7 +22,7 @@ Set the initial value of the accumulator to `0`.
Your `reduce` method should have `0` as the initial value.
```js
assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\)/)
assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\s*\)/)
```
# --seed--
@@ -28,19 +28,19 @@ assert.notMatch(getMean.toString(), /mean\s*=/);
You should not change the logic within the `reduce` method.
```js
assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\)/)
assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\s*\)/)
```
You should divide the result of the `reduce` method by the length of the array.
```js
assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\)\s*\/\s*array\.length/)
assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\s*\)\s*\/\s*array\.length/)
```
You should use implicit return syntax to directly return the result of `reduce` divided by the array length.
```js
assert.match(code, /const\s+getMean\s*=\s*\(?array\)?\s*=>\s*array\.reduce\(\(acc\s*,\s*el\)\s*=>\s*acc\s*\+\s*el\s*,\s*0\s*\)\s*\/\s*array\.length/)
assert.match(code, /const\s+getMean\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>\s*acc\s*\+\s*el\s*,\s*0\s*\)\s*\/\s*array\.length/)
```
# --seed--
@@ -18,13 +18,13 @@ To sort your numbers from smallest to largest, pass a callback function that tak
Your `sort` method should have a callback function which takes an `a` and a `b` parameters.
```js
assert.match(getMedian.toString(), /(array\.sort\(\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(function\s*\(\s*a\s*,\s*b\)\s*\{)/)
assert.match(getMedian.toString(), /(array\.sort\(\s*\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{)/)
```
Your `sort` method should return the result of subtracting `b` from `a`.
```js
assert.match(getMedian.toString(), /(array\.sort\(\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(function\s*\(\s*a\s*,\s*b\)\s*\{)\s*(return)?\s*a\s*\-\s*b/)
assert.match(getMedian.toString(), /(array\.sort\(\s*\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{)\s*(return\s+)?\s*a\s*\-\s*b/)
```
# --seed--
@@ -22,13 +22,13 @@ assert.match(calculate.toString(), /median\s*=/);
Your `median` variable should be assigned the value of `getMedian(numbers)`.
```js
assert.match(calculate.toString(), /median\s*=\s*getMedian\(numbers\)/);
assert.match(calculate.toString(), /median\s*=\s*getMedian\(\s*numbers\s*\)/);
```
Your `calculate` function should query the DOM for the `#median` element and set the `textContent` to `median`.
```js
assert.match(calculate.toString(), /document\.querySelector\(('|")#median\1\)\.textContent\s*=\s*median/);
assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#median\1\s*\)\.textContent\s*=\s*median/);
```
# --seed--
@@ -133,7 +133,7 @@ const calculate = () => {
const value = document.querySelector("#numbers").value;
const array = value.split(/,\s*/g);
const numbers = array.map(el => Number(el)).filter(el => !isNaN(el));
--fcc-editable-region--
const mean = getMean(numbers);
@@ -22,13 +22,13 @@ assert.match(getMode.toString(), /array\.forEach\(/);
Your `.forEach()` method should have a callback function which takes an `el` parameter.
```js
assert.match(getMode.toString(), /(array\.forEach\(\(?\s*el\s*\)?\s*=>|array\.forEach\(function\s*\(?el\)?\s*\{)/);
assert.match(getMode.toString(), /(array\.forEach\(\s*(\(\s*el\s*\)|el)\s*=>|array\.forEach\(\s*function\s*\(\s*el\s*\)\s*\{)/);
```
Your `.forEach()` method should increment the count for each number. Don't forget the fallback value.
```js
assert.match(getMode.toString(), /(array\.forEach\(\(?\s*el\s*\)?\s*=>|array\.forEach\(function\s*\(?el\)?\s*\{)\s*\{?\s*(return)?\s*counts\s*\[\s*el\s*\]\s*=\s*\(\s*counts\s*\[\s*el\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1\s*\}?/);
assert.match(getMode.toString(), /(array\.forEach\(\s*(\(\s*el\s*\)|el)\s*=>|array\.forEach\(\s*function\s*\(\s*el\s*\)\s*\{)\s*\{?\s*(return)?\s*counts\s*\[\s*el\s*\]\s*=\s*\(\s*counts\s*\[\s*el\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1\s*\}?/);
```
# --seed--
@@ -24,7 +24,7 @@ assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.so
Your `getMode` function should pass a callback to the `sort` method with parameters `a` and `b`.
```js
assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(function\s*\(\s*a\s*,\s*b\s*\)/)
assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)/)
```
Your `getMode` function should use the `sort` method to sort the `Object.keys()` array and return the value of `counts[b]` minus the value of `counts[a]`.
@@ -20,13 +20,13 @@ assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filte
Your `.filter()` method should take a callback function with a parameter `el`.
```js
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(function\s*\(\s*el\s*\)/);
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(\s*function\s*\(\s*el\s*\)/);
```
Your `.filter()` method should return whether the value of `counts[el]` is equal to `counts[highest]`.
```js
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(function\s*\(\s*el\s*\)\s*\{\s*return\s+counts\s*\[\s*el\s*\]\s*===\s*counts\s*\[\s*highest\s*\]\s*;\s*\}/);
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(\s*function\s*\(\s*el\s*\)\s*\{\s*return\s+counts\s*\[\s*el\s*\]\s*===\s*counts\s*\[\s*highest\s*\]\s*;\s*\}/);
```
# --seed--
@@ -20,7 +20,7 @@ assert.match(calculate.toString(), /mode\s*=\s*getMode\(\s*numbers\s*\);/);
Your `calculate` function should query the DOM for the `#mode` element and set the `textContent` to `mode`.
```js
assert.match(calculate.toString(), /document\.querySelector\(('|")#mode\1\)\.textContent\s*=\s*mode;/);
assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#mode\1\s*\)\.textContent\s*=\s*mode;/);
```
# --seed--
@@ -14,13 +14,13 @@ Add the logic for calculating and displaying the range to your `calculate` funct
Your `calculate` function should set a `range` variable to the result of `getRange(numbers)`.
```js
assert.match(calculate.toString(), /range\s*=\s*getRange\(numbers\);/);
assert.match(calculate.toString(), /range\s*=\s*getRange\(\s*numbers\s*\);/);
```
Your `calculate` function should set the `#range` element's `textContent` to the `range` variable.
```js
assert.match(calculate.toString(), /document\.querySelector\(('|")#range\1\)\.textContent\s*=\s*range;/);
assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#range\1\s*\)\.textContent\s*=\s*range;/);
```
# --seed--
@@ -26,13 +26,13 @@ assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(/);
Your `differences` variable should use the `el` parameter in the callback function.
```js
assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(function\s*\(?\s*el\s*\)?/);
assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(\s*function\s*\(?\s*el\s*\)?/);
```
Your `map` callback should return the value of `el` minus `mean`.
```js
assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(function\s*\(?\s*el\s*\)?\s*\{\s*return\s+el\s*-\s*mean;?\s*\}/);
assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(\s*function\s*\(?\s*el\s*\)?\s*\{\s*return\s+el\s*-\s*mean;?\s*\}/);
```
# --seed--
@@ -28,13 +28,13 @@ assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\
Your `squaredDifferences` variable should use the `el` parameter in the callback function.
```js
assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(function\s*\(?\s*el\s*\)?/);
assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(\s*function\s*\(?\s*el\s*\)?/);
```
Your `map` callback should return the value of `el` squared.
```js
assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(function\s*\(?\s*el\s*\)?\s*\{\s*return\s+Math\.pow\(\s*el\s*,\s*2\s*\);\s*\}/);
assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(\s*function\s*\(?\s*el\s*\)?\s*\{\s*return\s+Math\.pow\(\s*el\s*,\s*2\s*\);\s*\}/);
```
Your `map` callback should use the `**` operator.
@@ -28,13 +28,13 @@ assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDiffere
Your `sumSquaredDifferences` variable should use the `acc` and `el` parameters in the callback function.
```js
assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)/);
assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)/);
```
Your `reduce` callback should return the sum of `acc` and `el`.
```js
assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*return\s*acc\s*\+\s*el\s*\;\s*\},\s*0\s*\)/);
assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*return\s*acc\s*\+\s*el\s*\;\s*\},\s*0\s*\)/);
```
# --seed--
@@ -46,19 +46,19 @@ assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(/);
Your `variance` variable should use the `acc` and `el` parameters in the callback function.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)/);
```
Your `reduce` callback should be an empty function.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*\}/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*\}/);
```
Your `reduce` callback should have an initial value of `0`.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*\}\s*,\s*0\s*\)/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*\}\s*,\s*0\s*\)/);
```
# --seed--
@@ -14,37 +14,37 @@ Within your empty `.reduce()` callback, declare a variable `difference` and set
Your `reduce` callback should have a `difference` variable.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=/);
```
Your `difference` variable should be set to the value of `el` minus `mean`.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;/);
```
Your `reduce` callback should have a `squared` variable.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=/);
```
Your `squared` variable should be set to the value of `difference` to the power of 2.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);/);
```
Your `reduce` callback should return the value of `acc` plus `squared`.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;/);
```
You should not remove the initial value of `0` from your `.reduce()` method.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\)/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\s*\)/);
```
# --seed--
@@ -16,7 +16,7 @@ Divide your `.reduce()` call by the length of the array (in your `variance` decl
You should divide the result of the `.reduce()` call by the length of the array.
```js
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\)\s*\/\s*array\.length;/);
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\s*\)\s*\/\s*array\.length;/);
```
You should return the value of `variance`.
@@ -20,7 +20,7 @@ assert.match(calculate.toString(), /variance\s*=\s*getVariance\(\s*numbers\s*\)/
You should set the `textContent` of the `#variance` element to the value of the `variance` variable.
```js
assert.match(calculate.toString(), /document\.querySelector\(('|")#variance\1\)\.textContent\s*=\s*variance/);
assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#variance\1\s*\)\.textContent\s*=\s*variance/);
```
# --seed--
@@ -14,13 +14,13 @@ Now update the `calculate` function to include the standard deviation logic, lik
Your `calculate` function should have a `standardDeviation` variable set to the result of `getStandardDeviation(numbers)`.
```js
assert.match(calculate.toString(), /standardDeviation\s*=\s*getStandardDeviation\(numbers\)/);
assert.match(calculate.toString(), /standardDeviation\s*=\s*getStandardDeviation\(\s*numbers\s*\)/);
```
You should update the `textContent` of the `#standardDeviation` element to be the `standardDeviation` variable.
```js
assert.match(calculate.toString(), /document\.querySelector\(('|")#standardDeviation\1\)\.textContent\s*=\s*standardDeviation/);
assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#standardDeviation\1\s*\)\.textContent\s*=\s*standardDeviation/);
```
# --seed--
@@ -16,19 +16,19 @@ To fix this, add an empty `.slice()` call before your `.sort()` method. The empt
You should call `.slice()` on the `array` parameter.
```js
assert.match(getMedian.toString(), /array\.slice\(\)/);
assert.match(getMedian.toString(), /array\.slice\(\s*\)/);
```
Your `.sort()` call should be chained to the `.slice()` call.
```js
assert.match(getMedian.toString(), /array\.slice\(\)\.sort\(/);
assert.match(getMedian.toString(), /array\.slice\(\s*\)\.sort\(/);
```
You should not modify the `.sort()` method callback.
```js
assert.match(getMedian.toString(), /array\.slice\(\)\.sort\(function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*(return)?\s*a\s*\-\s*b/)
assert.match(getMedian.toString(), /array\.slice\(\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*(return\s+)?\s*a\s*\-\s*b/)
```
# --seed--
@@ -24,7 +24,7 @@ Use the `async` keyword to create an asynchronous arrow function called `fetchDa
You should use the `async` keyword to create an asynchronous arrow function called `fetchData`.
```js
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*[^}]*\s*}/);
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*[^}]*\s*}/);
```
`fetchData` should be defined.
@@ -37,7 +37,7 @@ assert.match(code, /\s*const\s+res\s*=\s*await\s+fetch\(\s*(.*)\s*\)/);
You should pass in the `forumLatest` constant to the `fetch` call.
```js
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{\s*const\s+res\s*=\s*await\s+fetch\(\s*forumLatest\s*\)\s*;?\s*}\s*catch\s*\(\s*err\s*\)\s*{\s*}\s*}/);
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{\s*const\s+res\s*=\s*await\s+fetch\(\s*forumLatest\s*\)\s*;?\s*}\s*catch\s*\(\s*err\s*\)\s*{\s*}\s*}/);
```
# --seed--
@@ -22,7 +22,7 @@ assert.match(code, /const\s+data/);
You should assign `await res.json()` to the `data` variable.
```js
assert.match(code, /\s*const\s+data\s*=\s*await\s+res\.json\(\);?\s*/);
assert.match(code, /\s*const\s+data\s*=\s*await\s+res\.json\(\s*\);?\s*/);
```
# --seed--
@@ -28,7 +28,7 @@ assert.match(code, /\s*try\s*{[\s\S]*\s*console\.log\(\s*data\s*\)[\s\S]*}\s*cat
You should call the `fetchData()` function, after the `fetchData()` function is defined.
```js
assert.match(code, /};?\s*fetchData\(\)/);
assert.match(code, /};?\s*fetchData\(\s*\)/);
```
# --seed--
@@ -22,7 +22,7 @@ assert.match(code, /\s*showLatestPosts\(.*\);??\s*/);
You should pass `data` as the argument to `showLatestsPosts()`.
```js
assert.match(code, /\s*showLatestPosts\(data\);?\s*/);
assert.match(code, /\s*showLatestPosts\(\s*data\s*\);?\s*/);
```
# --seed--
@@ -20,7 +20,7 @@ assert.match(code, /\s*const\s+thousands\s*=/);
Your should assign `Math.floor(views / 1000)` to your `thousands` variable.
```js
assert.match(code, /\s*const\s+thousands\s*=\s*Math\.floor\(views\s*\/\s*1000\)\s*/);
assert.match(code, /\s*const\s+thousands\s*=\s*Math\.floor\(\s*views\s*\/\s*1000\s*\)\s*/);
```
# --seed--
@@ -27,19 +27,19 @@ Inside your `fetchData` function, add a `try...catch` statement. The `catch` blo
You should have a `try` block inside your `fetchData` function.
```js
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{[^}]*\s*}/);
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{[^}]*\s*}/);
```
You should have a `catch` block after your `try` block.
```js
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(.*\)\s*{[^}]*\s*}/);
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(.*\)\s*{[^}]*\s*}/);
```
Your `catch` block should have an `err` parameter.
```js
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(\s*err\s*\)\s*{[^}]*\s*}/);
assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(\s*err\s*\)\s*{[^}]*\s*}/);
```
@@ -20,13 +20,13 @@ assert.match(code, /const\s+postsContainer\s*=/);
You should use `document.getElementById()` to get the `#posts-container` element.
```js
assert.match(code, /document\.getElementById\(('|"|`)posts-container\1\)/);
assert.match(code, /document\.getElementById\(\s*('|"|`)posts-container\1\s*\)/);
```
You should assign the `#posts-container` element to your `postsContainer` variable.
```js
assert(code.match(/const\s+postsContainer\s*=\s*document\.getElementById\(('|"|`)posts-container\1\)/g));
assert(code.match(/const\s+postsContainer\s*=\s*document\.getElementById\(\s*('|"|`)posts-container\1\s*\)/g));
```
# --seed--
@@ -14,7 +14,7 @@ You will be using this as an event listener for the `sortButton`. Because button
Your `sortInputArray` function should call `event.preventDefault()`.
```js
assert.match(sortInputArray.toString(), /event\.preventDefault\(\)/);
assert.match(sortInputArray.toString(), /event\.preventDefault\(\s*\)/);
```
# --seed--
@@ -17,7 +17,7 @@ You should remove your `console.log()` call.
```js
// Thanks loop-protect
assert.notMatch(bubbleSort.toString(), /console\.log\((?!"Potential infinite)/);
assert.notMatch(bubbleSort.toString(), /console\.log\(\s*(?!"Potential infinite)/);
```
# --seed--
@@ -15,7 +15,7 @@ You should remove the `console.log()` statement from `selectionSort()`.
```js
// Thanks loop-protect
assert.notMatch(selectionSort.toString(), /console\.log\((?!"Potential infinite)/);
assert.notMatch(selectionSort.toString(), /console\.log\(\s*(?!"Potential infinite)/);
```
# --seed--
@@ -36,7 +36,7 @@ assert.match(code, /document\.querySelector/);
You should use the `#button1` selector.
```js
assert.match(code, /querySelector\(('|")#button1\1\)/);
assert.match(code, /querySelector\(\s*('|")#button1\1\s*\)/);
```
# --seed--
@@ -20,13 +20,13 @@ function functionName() {
You should have a `console.log("Going to store.");` line in your code. Don't forget the semi-colon.
```js
assert.match(code, /console\.log\(('|")Going to store\.\1\);/);
assert.match(code, /console\.log\(\s*('|")Going to store\.\1\s*\);/);
```
Your `console.log("Going to store.");` line should be in your `goStore` function.
```js
assert.match(goStore.toString(), /console\.log\(('|")Going to store\.\1\);/);
assert.match(goStore.toString(), /console\.log\(\s*('|")Going to store\.\1\s*\);/);
```
# --seed--
@@ -26,13 +26,13 @@ assert.isFunction(goCave);
You should have a `console.log("Going to cave.");` line in your code.
```js
assert.match(code, /console\.log\(('|")Going to cave\.\1\)/);
assert.match(code, /console\.log\(\s*('|")Going to cave\.\1\s*\)/);
```
Your `console.log("Going to cave.");` line should be inside your `goCave` function.
```js
assert.match(goCave.toString(), /console\.log\(('|")Going to cave\.\1\)/);
assert.match(goCave.toString(), /console\.log\(\s*('|")Going to cave\.\1\s*\)/);
```
# --seed--
@@ -26,13 +26,13 @@ assert.isFunction(fightDragon);
You should have a `console.log("Fighting dragon.");` line in your code.
```js
assert.match(code, /console\.log\(('|")Fighting dragon\.\1\)/);
assert.match(code, /console\.log\(\s*('|")Fighting dragon\.\1\s*\)/);
```
Your `console.log("Fighting dragon.");` line should be inside your `fightDragon` function.
```js
assert.match(fightDragon.toString(), /console\.log\(('|")Fighting dragon\.\1\)/);
assert.match(fightDragon.toString(), /console\.log\(\s*('|")Fighting dragon\.\1\s*\)/);
```
# --seed--
@@ -23,7 +23,7 @@ When a player clicks your `Go to store` button, you want to change the buttons a
You should not have a `console.log("Going to store.");` line in your code.
```js
assert.notMatch(code, /console\.log\(('|")Going to store\.\1\)/);
assert.notMatch(code, /console\.log\(\s*('|")Going to store\.\1\s*\)/);
```
You should use dot notation to access the `innerText` property of `button1`.
@@ -28,7 +28,7 @@ assert.match(code, /function\s+update/);
Your `update` function should take a parameter called `location`.
```js
assert.match(update.toString(), /update\(location\)/);
assert.match(update.toString(), /update\(\s*location\s*\)/);
```
Your `update` function should be empty.
@@ -56,13 +56,13 @@ assert.match(update.toString(), /text\.innerText\s*=\s*"You are in the town squa
Your `goTown` function should be empty.
```js
assert.match(goTown.toString(), /function goTown\(\) \{\}/);
assert.match(goTown.toString(), /function goTown\(\s*\) \{\}/);
```
Your `goStore` function should be empty.
```js
assert.match(goStore.toString(), /function goStore\(\) \{\}/);
assert.match(goStore.toString(), /function goStore\(\s*\) \{\}/);
```
# --seed--
@@ -20,13 +20,13 @@ myFunction();
You should call the `update` function in the `goTown` function.
```js
assert.match(goTown.toString(), /update\(\)/);
assert.match(goTown.toString(), /update\(\s*\)/);
```
Don't forget your ending semi-colon.
```js
assert.match(goTown.toString(), /update\(\);/);
assert.match(goTown.toString(), /update\(\s*\);/);
```
# --seed--

Some files were not shown because too many files have changed in this diff Show More