force label:
[70, 75, 72, 58, 64, 74, 52, 64, 62, 67, 62, 55, 72, 63, 65, 15, 38, 63, 30, 65, 69, 52, 72, 70, 32, 72, 75, 60, 90, 35]
intel label:
[60, 74, 27, 58, 59, 72, 64, 52, 54, 54, 60, 37, 35, 52, 57, 76, 81, 38, 63, 41, 59, 87, 46, 22, 54, 46, 23, 85, 80, 58]
Answer label:
[1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0]
In the force list and the intel list, 1 is output if the force is large, and 0 is output if the intel is large I'd like to code to show the correspondence with the value of answer, what should I do?
python coding
[1 if force[index] > intel[index] else 0 for index in range(len(force))]
To find and compare the index starting with 0 in range.
It is possible to tie two arrays using a zip.
If you want to find out the consistency of the values
value = []
for index in range(len(force)):
if force[index] > intel[index]:
value.append(1)
else:
value.append(0)
print(force[index] - intel[index]
It is easiest to create additional syntax using the following methods:
© 2024 OneMinuteCode. All rights reserved.