-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathareTheyEqual.py
47 lines (41 loc) · 1.03 KB
/
areTheyEqual.py
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
45
46
47
import math
def are_they_equal(array_a, array_b):
# Write your code here
array_a.sort()
array_b.sort()
for i in range(len(array_a)):
if array_a[i] != array_b[i]:
return False;
return True
def printString(string):
print('[\"', string, '\"]', sep='', end='')
test_case_number = 1
def check(expected, output):
global test_case_number
result = False
if expected == output:
result = True
rightTick = '\u2713'
wrongTick = '\u2717'
if result:
print(rightTick, 'Test #', test_case_number, sep='')
else:
print(wrongTick, 'Test #', test_case_number, ': Expected ', sep='', end='')
printString(expected)
print(' Your output: ', end='')
printString(output)
print()
test_case_number += 1
if __name__ == "__main__":
n_1 = 4
a_1 = [1, 2, 3, 4]
b_1 = [1, 4, 3, 2]
expected_1 = True
output_1 = are_they_equal(a_1, b_1)
check(expected_1, output_1)
n_2 = 4
a_2 = [1, 2, 3, 4]
b_2 = [1, 2, 3, 5]
expected_2 = False
output_2 = are_they_equal(a_2, b_2)
check(expected_2, output_2)