Why does the else statement get printed here?
for elem in data:
if choose_id == elem['id']:
print(f"{elem['ip']} : {elem['id']}")
else:
print("No ID found")
output is:
ID to search > 6
10.xx.xxx.xx : 6
10.xx.xxx.xx : 6
10.xx.xxx.xx : 6
10.xx.xxx.xx : 6
No ID found
I've tried putting in a 'break' statement in the if block but it only iterates once.
I'd appreciate some advice.