You could simply use the in
keyword. Like this :
if number_you_are_looking_for in list:
# your code here
For instance :
myList = [1,2,3,4,5]
if 3 in myList:
print("3 is present")
You could simply use the in
keyword. Like this :
if number_you_are_looking_for in list:
# your code here
For instance :
myList = [1,2,3,4,5]
if 3 in myList:
print("3 is present")