I’m having some issue with Ex1 of the Assignment. Particularly,
Wrong output for questions in batch 1.
Expected [[ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]
[30 55 56 57 58 59 60 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]
[30 61 6 62 63 64 65 66 67 68 69 70 71 72 73 74 75 21 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]
[32 33 4 34 6 35 36 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]
[86 87 88 89 90 91 92 93 17 87 94 95 72 96 21 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]].
Got [[ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 1 1 1
1 1 1 1 1 1 1 1]
[30 55 56 57 58 59 60 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]
[30 61 6 62 63 64 65 66 67 68 69 70 71 72 73 74 75 21 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]
[32 33 4 34 6 35 36 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1]
[86 87 88 89 90 91 92 93 17 87 94 95 72 96 21 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1]].
Wrong output for questions in batch 2.
Expected [[ 4 22 6 23 7 24 8 25 26 11 27 28 7 29 30 16 31 18
19 20 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
[ 30 55 56 57 58 59 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
[ 32 76 6 62 63 77 78 71 79 28 80 81 82 39 83 28 80 21
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
[ 30 37 4 38 39 34 6 40 36 21 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
[ 86 38 97 98 90 93 99 33 34 95 100 101 96 21 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]].
Got [[ 4 22 6 23 7 24 8 25 26 11 27 28 7 29 30 16 31 18
19 20 21 1 1 1 1 1 1 1 1 1 1 1]
[ 30 55 56 57 58 59 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
[ 32 76 6 62 63 77 78 71 79 28 80 81 82 39 83 28 80 21
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
[ 30 37 4 38 39 34 6 40 36 21 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1]
[ 86 38 97 98 90 93 99 33 34 95 100 101 96 21 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]].
6 Tests passed
2 Tests failed
I guess it has to do with the padding variable not correctly being used in the instantiation of the q1 and q2 array, but I can not seem to figure out what’s wrong. For context, I’ve tried the following ways so far
# add [pad] to q1 until it reaches max_len
q1 += [pad for _ in range(max_len - len(q1))]
# add [pad] to q2 until it reaches max_len
q2 += [pad for _ in range(max_len - len(q2))]
q1 += [pad] * (max_len - len(q1))
# add [pad] to q2 until it reaches max_len
q2 += [pad] * (max_len - len(q2))