This if
-elif
is simple and straightforward. index is a 1-D array with values of 0
-5
only. As you can see from the image, the only correct if
-elif
is only for index[i]==0
and index[i]==1
. For index[i]==5
, it was supposed to print f
but the result was printed as d
. What went wrong?
Current output:
for i in index:
print(i)
if index[i]==0:
print(" :a")
elif index[i]==1:
print(" :b")
elif index[i]==2:
print(" :c")
elif index[i]==3:
print(" :d")
elif index[i]==4:
print(" :e")
elif index[i]==5:
print(" :f")