Nov-18-2019, 01:28 PM
Note that a line that is just
Me thinks the simplest way to do this is to check each rule for failure. If it fails, return False. This ends the function, and is called short circuiting the calculation, as buran mentioned. Then at the end, you return True. That will only happen if none of the tests failed.
True
or just False
does nothing. You need to assign that value or return it or something. Otherwise it just disappears.Me thinks the simplest way to do this is to check each rule for failure. If it fails, return False. This ends the function, and is called short circuiting the calculation, as buran mentioned. Then at the end, you return True. That will only happen if none of the tests failed.
def validate(text): if text[0] != 4: return False ... return True
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures