Script for finding words of any size that do NOT contain vowels with acute diacritic marks?
Ian Kelly
ian.g.kelly at gmail.com
Wed Oct 17 14:27:12 EDT 2012
On Wed, Oct 17, 2012 at 12:17 PM, <wxjmfauth at gmail.com> wrote:
> Not at all, I knew this. In this I decided to program like
> this.
>
> Do you get it? Yes/No or True/False
It's just bad style, because both 'yes' and 'no' evaluate true.
if HasDiacritics('éléphant'):
print('Correct!')
if HasDiacritics('elephant'):
print('Error!')
Prints:
Correct!
Error!
You could replace the test with "if HasDiacritics('elephant') ==
'yes':", but why force the caller to write that out when the former
test is more natural and less prone to error (e.g. typoing 'yes')?
More information about the Python-list
mailing list