How to check if a specific integer is in a list
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")
Are you looking for this?:
if n in my_list:
---do something---
Where n
is the number you're checking. For example:
my_list = [1,2,3,4,5,6,7,8,9,0]
if 1 in my_list:
print 'True'