Reputation: 942
I know this is a very simple question but I would like to know how to check each index from the list or 1 by 1, from starting to ending of the index. without using lambda just a simple for loop.
List = ['a','b','c']
required = 'c'
output:
>>False
>>False
>>True
Upvotes: 3
Views: 43
Reputation: 539
def test(check):
try:
for i in L:
if i == check:
print 'True'
else:
print 'False'
# print cmp(i,check)
except:
pass
test('c')
very basic..:)
Upvotes: 2