Reputation: 41
This is my Python code:
funcName = 'anything'
if funcName.find("Start") > 0 or funcName.find("start") > 0 or
funcName.find("Main") > 0 or funcName.find("main"):
print 'success'
else:
print 'fail'
The code output is success, but I think output must be fail.
Why is the output success?
Upvotes: 1
Views: 85
Reputation: 44087
You need to check the last find
call too - -1
won't be automatically regarded as false.
if funcName.find("Start") > 0 or funcName.find("start") > 0 or funcName.find("Main") > 0 or funcName.find("main") > 0:
Upvotes: 8