I'm trying to run the following python function in sublime text editor
def match_find(data,target):
for i in data:
if i == target:
return True
else:
return False
match_find([1,2,3,5,6,5,6,6,6,4],9)
The expected O/p here is false but the sublime text doesn't return the o/p.
Whereas when I tried the same code in jupyter notebooks, it worked fine.
What feature do I have to enable in sublime text editor so that it returns the o/p?
I have "Tools > Build System > Python selected and I have the "Tools > Save All on Build" option selected.
There is no issues with sublime, You code is having inconsistencies. the else would belong to the 'for' statement not 'if'. Use print statement to printout the value, currently just returning the boolean doesn't print anything
def match_find(data,target):
for i in data:
if i == target:
return True
else:
return False
print(match_find([1,2,3,5,6,5,6,6,6,4],4))