-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax-error.json
44 lines (44 loc) · 5.17 KB
/
syntax-error.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[
"\n{'code': 'count = sum(arr)'}",
"\n{'code': 'def count_values(arr):\\n return sum(arr)'}",
"\n{'code': 'total = 0\\nfor item in arr:\\n total += item'}",
"\n{'code': 'import numpy as np\\ncount = np.sum(arr)'}",
"\n{'code': 'import numpy as np\\ncount=np.sum(arr)', 'expected_output': 20, 'explanation': 'numpy sum function'}",
"\n{'code': 'import numpy as np\\ncount=0\\nfor (index, value) in enumerate(arr):\\n count += value', 'expected_output': 20, 'explanation': 'numpy sum function'}",
"\n{'code': 'import numpy as np\\ncount=0\\nfor value in arr:\\n count += value', 'expected_output': 20, 'explanation': 'manual sum function'}",
"\n{'code': 'count=0\\nfor index, value in enumerate(arr):\\n count += value', 'expected_output': 20, 'explanation': 'manual sum function with index'}",
"\n{'code': 'count=0\\nfor value in arr:\\n count += value\\ncount', 'expected_output': 20, 'explanation': 'manual sum function with print statement'}",
"\n{'code': \"count=0\\nfor index, value in enumerate(arr):\\n count += value\\nprint('Sum:',count)\", 'expected_output': 20, 'explanation': 'manual sum function with print statement and variable name'}",
"\n{'code': '\\nx = 1\\ny = 2\\nz = 3\\n(a, b, c) = [x, y, z][::-1]\\n', 'explanation': 'An explanation for this code.', 'input': {'x': 1, 'y': 2, 'z': 3}, 'output': {'a': 3, 'b': 2, 'c': 1}}",
"\n{'code': '\\nx, y, z = 1, 2, 3\\n(a, b, c) = [x, y, z][::-1]\\n', 'explanation': 'An explanation for this code.', 'input': {'x': 1, 'y': 2, 'z': 3}, 'output': {'a': 3, 'b': 2, 'c': 1}}",
"\n{'code': '\\ndef reverse(a, b, c):\\n return (c, b, a)\\nx = 1\\ny = 2\\nz = 3\\n(a, b, c) = reverse(x, y, z)\\n', 'explanation': 'An explanation for this code.', 'input': {'x': 1, 'y': 2, 'z': 3}, 'output': {'a': 3, 'b': 2, 'c': 1}}",
"\n{'code': 'b,a,c = x,y,z', 'explanation': 'This is the same as the original code but with the variables in the assignment statement swapped', 'is_correct': True}",
"\n{'code': '(a,b,c) = (x,y,z)', 'explanation': 'This is the same as the original code but with the assignment statement surrounded by parenthesis', 'is_correct': True}",
"\n{'code': 'import collections\\ndeque([collections.deque([x]), collections.deque([y]), collections.deque([z]))'}",
"\n{'code': 'deque([list(x), list(y), list(z)])'}",
"\n{'code': '(a, b, c) = map(lambda x, y, z: x, [x], [y], [z])', 'explanation': 'Use map to apply a function to multiple iterables.', 'level': 'beginner'}",
"\n{'code': 'from itertools import zip_longest\\n(a, b, c) = zip_longest([x], [y], [z])', 'explanation': 'Use zip_longest to concatenate iterables of different lengths.', 'level': 'intermediate'}",
"\n{'code': 'import numpy as np\\n(a, b, c) = np.array([x], [y], [z]).T', 'explanation': 'Use numpy.array and .T to transpose a 1D array.', 'level': 'expert'}",
"\n{'code': '(a, b, c) = list(zip(*[x, y, z]))'}",
"\n{'code': 'a, b, c = x, y, z'}",
"\n{'code': 'def swap(a, b): return b, a\\nswap(x, y)\\n(a, b, c) = (x, y, z)'}",
"\n{'code': 'a, b, c = [x, y, z]'}",
"\n{'code': '(a, b, c) = sorted([x, y, z])'}",
"\n{'code': 'a, b, c = list(map(sorted, zip([x, y, z])))'}",
"\n{'code': 'a = x\\nb = y\\nc = z'}",
"\n{'code': 'import numpy as np\\nnp.concatenate([b, a, c])', 'explanation': 'Use numpy to concatenate the arrays', 'level': 'beginner', 'imports': ['numpy']}",
"\n{'code': 'b = np.concatenate([b, a, c])\\n', 'explanation': 'Use an assignment statement to concatenate the arrays', 'level': 'intermediate', 'imports': ['numpy']}",
"\n{'code': 'def concat(a, b, c):\\n return np.concatenate([a, b, c])\\nconcat(b, a, c)', 'explanation': 'Create a function to concatenate the arrays', 'level': 'expert', 'imports': ['numpy']}",
"\n{'code': 'import numpy as np\\nif np.all(a == b == c):\\nelif not np.any(a == b == c):\\n', 'explanation': 'using np.all and np.any to check if all elements in a are equal to b and c'}",
"\n{'code': 'import numpy as np\\nif np.array_equal(a,b,c):\\nelif not np.array_equal(a,b,c):\\n', 'explanation': 'using np.array_equal to check if a,b,c are equal'}",
"\n{'code': 'import numpy as np\\nif np.equal(a,b,c):\\nelif not np.equal(a,b,c):\\n', 'explanation': 'using np.equal to check if a,b,c are equal'}",
"\n['tuple([[x], [y], [z]])']",
"\n{'code': 'b=2*c + 1\\na=b\\nc=4*a', 'explanation': 'simple code', 'level': 'beginner'}",
"\n{'code': 'from functools import reduce\\nreducer = lambda a, b: a + b\\nreducer(1, reduce(reducer, range(2, z+1)))', 'explanation': 'advanced code using functools', 'level': 'expert'}",
"\n{'code': 'import math\\nmath.fmod(a,b)', 'is_better': False, 'is_intermediate': False, 'is_expert': False}",
"\n{'code': 'c = [x, y, z[::-1]]\\na = c[0]\\nb = c[1]\\nc = c[2]', 'is_better': True, 'is_intermediate': True, 'is_expert': False}",
"\n{'code': 'c = list(reversed(z))\\n(a, b, c) = (x, y, c)', 'is_better': True, 'is_intermediate': True, 'is_expert': True}",
"\n{'code': 'import numpy as np\\np_array = np.array([x, y, z])\\np.transpose(p_array)[0]', 'type': 'beginner', 'import': ['numpy']}",
"\n{'code': 'from numpy import transpose as tp\\ntp([x, y, z])[0]', 'type': 'intermediate', 'import': ['numpy']}",
"\n{'code': 'import numpy as np\\n(b, a, c) = np.transpose([x, y, z])', 'type': 'expert', 'import': ['numpy']}"
]