diff --git a/autofill.sh b/autofill.sh index 90ce1d7..67c4309 100755 --- a/autofill.sh +++ b/autofill.sh @@ -1 +1 @@ -checkio --domain py autofillrepo --py-function sum_two --js-function sumTwo . +checkio --domain py autofillrepo --py-function replace_first --js-function replaceFirst . diff --git a/editor/animation/init.js b/editor/animation/init.js index a24cfc6..c6301a4 100644 --- a/editor/animation/init.js +++ b/editor/animation/init.js @@ -8,8 +8,8 @@ requirejs(['ext_editor_io', 'jquery_190'], var io = new extIO({ multipleArguments: true, functions: { - python: 'sum_two', - js: 'sumTwo' + python: 'replace_first', + js: 'replaceFirst' } }); io.start(); diff --git a/editor/initial_code/js_node b/editor/initial_code/js_node index f6e2dc2..1910f29 100644 --- a/editor/initial_code/js_node +++ b/editor/initial_code/js_node @@ -1,19 +1,21 @@ "use strict"; -function sumTwo(a, b) { - // sums two passed arguments - +function replaceFirst(a) { // your code here - return 0; + return undefined; } var assert = require('assert'); + if (!global.is_checking) { console.log('Example:'); - console.log(sumTwo(3, 2)); + console.log(replaceFirst([1, 2, 3, 4])); + + // These "asserts" are used for self-checking + assert.deepEqual(replaceFirst([1, 2, 3, 4]), [2, 3, 4, 1]); + assert.deepEqual(replaceFirst([1]), [1]); + assert.deepEqual(replaceFirst([]), []); - // These "asserts" are used for self-checking and not for an auto-testing - assert.equal(sumTwo(3, 2), 5); - assert.equal(sumTwo(5, 7), 12); console.log("Coding complete? Click 'Check' to earn cool rewards!"); } + \ No newline at end of file diff --git a/editor/initial_code/python_3 b/editor/initial_code/python_3 index 5e64eec..36dd656 100644 --- a/editor/initial_code/python_3 +++ b/editor/initial_code/python_3 @@ -1,16 +1,14 @@ -def sum_two(a, b): - """ - sums two passed arguments - """ +def replace_first(a): # your code here return None if __name__ == '__main__': print("Example:") - print(sum_two(3, 2)) - + print(replace_first([1, 2, 3, 4])) + # These "asserts" are used for self-checking and not for an auto-testing - assert sum_two(3, 2) == 5, "First" - assert sum_two(5, 7) == 12, "Second" + assert replace_first([1, 2, 3, 4]) == [2, 3, 4, 1] + assert replace_first([1]) == [1] + assert replace_first([]) == [] print("Coding complete? Click 'Check' to earn cool rewards!") diff --git a/info/media/example.png b/info/media/example.png index dda436b..04da2ed 100644 Binary files a/info/media/example.png and b/info/media/example.png differ diff --git a/info/media/example.svg b/info/media/example.svg new file mode 100644 index 0000000..d6e2775 --- /dev/null +++ b/info/media/example.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/info/task_description.html b/info/task_description.html index 238e44e..611cf79 100644 --- a/info/task_description.html +++ b/info/task_description.html @@ -1,20 +1,19 @@

- Sum two passed ints + In a given array first element should become the last one. Empty array or array with only one element should stay the same

example

-

- Input: Two arguments. Both are ints. + Input: {% if interpreter.slug == "js-node" %}Array{% else %}Itarable{% endif %}.

- Output: Int. + Output: {% if interpreter.slug == "js-node" %}Array{% else %}Itarable{% endif %}.

@@ -25,28 +24,13 @@

{% if interpreter.slug == "js-node" %} -
sumTwo(2, 3) == 5
-sumTwo(5, 7) == 12
+
replaceFirst([1, 2, 3, 4]) == [2, 3, 4, 1]
+replaceFirst([1]) == [1]
 
{% else %} -
sum_two(2, 3) == 5
-sum_two(5, 7) == 12
+
replace_first([1, 2, 3, 4]) == [2, 3, 4, 1]
+replace_first([1]) == [1]
 
{% endif %} - - - -

- - How it’s used: - (math is used everywhere) -

- - - -

- Precondition: - both given ints should be between -1000 and 1000 -

diff --git a/info/task_short_description.html b/info/task_short_description.html index f5d8b9d..267a2e3 100644 --- a/info/task_short_description.html +++ b/info/task_short_description.html @@ -1 +1 @@ -Add short description \ No newline at end of file +The first element should become the last one \ No newline at end of file diff --git a/verification/referee.py b/verification/referee.py index d3ffb1c..2923a4f 100644 --- a/verification/referee.py +++ b/verification/referee.py @@ -38,8 +38,8 @@ CheckiOReferee( tests=TESTS, function_name={ - "python": "sum_two", - "js": "sumTwo" + "python": "replace_first", + "js": "replaceFirst" }, cover_code={ 'python-3': cover_codes.unwrap_args, diff --git a/verification/tests.py b/verification/tests.py index ac70df9..bc88db8 100644 --- a/verification/tests.py +++ b/verification/tests.py @@ -11,26 +11,30 @@ TESTS = { "Basics": [ { - "input": [3, 2], - "answer": 5, - "explanation": "3+2=?" + "input": [[1,2,3,4]], + "answer": [2,3,4,1], }, { - "input": [5, 7], - "answer": 12, - "explanation": "5+7=?" - } + "input": [[1]], + "answer": [1], + }, + { + "input": [[]], + "answer": [], + }, ], "Extra": [ { - "input": [6, 3], - "answer": 9, - "explanation": "6+3=?" + "input": [[10, 10]], + "answer": [10, 10], }, { - "input": [6, 7], - "answer": 13, - "explanation": "6+7=?" - } + "input": [[1,2,2,2]], + "answer": [2,2,2,1], + }, + { + "input": [[100]], + "answer": [100], + }, ] }