-
Notifications
You must be signed in to change notification settings - Fork 0
/
Nikhilam Test Code.py
37 lines (32 loc) · 957 Bytes
/
Nikhilam Test Code.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
# Hard-coded 5x5 multiplication table
multiple_table = [[0, 0, 0, 0, 0, 0],
[0, 1, 2, 3, 4, 5],
[0, 2, 4, 6, 8, 10],
[0, 3, 6, 9, 12, 15],
[0, 4, 8, 12, 16, 20],
[0, 5, 10, 15, 20, 25],
]
## Manual Testing ##
num1 =
num2 =
try:
ANS = main(num1, num2)
print('ANSWER: ', ANS)
print('IS IT CORRECT?', int(ANS) == num1 * num2)
except RecursionError:
print('ERROR: ', num1, 'x', num2)
## Exahaustive check for equations solved ##
count = 0
for i in range(10):
for x in range(10):
try:
ANS = main(x, i)
if ANS == 'Formula Not Applicable':
pass
elif not ANS == x * i:
print('NOT EQUAL', x, 'x', i, ANS)
else:
count += 1
except RecursionError:
print('ERROR: ', x, 'x', i)
print(count, 'equations solved')