The circumstances in my code make it as such that even after looking for a while, I couldn't find an applicable answer. This is a simplified version of my code:
value = int(input())
list = [5,10,15,20]
for i in list:
if i == value:
print("Value is in list.")
break
else:
print("Value is not in list.")
If I were to input 15, the code would print
"Value is not in list. Value is not in list. Value is in list."
but I only want it to print "Value is in list." one time if it is in the list and print "Value is not in list." one time if it is not. I have to keep the for loop and the if/else statements. As far as I can tell, I can't use break in the else without ending the loop entirely. What do I do?