Here are my lists
A = [32,33,34,35,36,37,38,39,40,41,42]
B = [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0]
C = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
D = [1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1]
Here, in list B value should be 0,in list C value should be 0 and in list D value should be 1 if this so then it is passed else failed. As you can see in list B index 2 value is 1 so it is failed like this in list C index 1 value is 1 instead of 0 and in list D index 3,4 value is 2 instead of 1. I've written the code for this but it is printing multiple time
my code-:
comment = "Wrong Signal in "
for first1 in A:
idx_val = A.index(first1)
if (B[idx_val] != 0):
comment = comment + 'B'
if C[idx_val] != 0:
comment = comment + 'C'
if D[idx_val] != 1:
comment = comment + 'D'
print comment
Output-'Wrong Signal in B,C,D,D,B
But i'm expecting the output like this
Output- 'Wrong Signal in B,C,D
and another example if B list's all value are zeros and C,D has wrong value in any index then it should print
output -'Wrong Signal in C,D
Thank You In Advance
Aucun commentaire:
Enregistrer un commentaire