diff options
| author | Simon Green <mail@simon.green> | 2024-06-16 20:43:00 +1000 |
|---|---|---|
| committer | Simon Green <mail@simon.green> | 2024-06-16 20:43:00 +1000 |
| commit | 84f502b31e856448e6e58a182c99180e0e9783ae (patch) | |
| tree | d48a351b20fe5add5fec2fcdf7f1e159da67ca71 /challenge-273/sgreen/python/ch-2.py | |
| parent | 514530d6be7cc5067a95a11ebedff9e0d4d46cfe (diff) | |
| download | perlweeklychallenge-club-84f502b31e856448e6e58a182c99180e0e9783ae.tar.gz perlweeklychallenge-club-84f502b31e856448e6e58a182c99180e0e9783ae.tar.bz2 perlweeklychallenge-club-84f502b31e856448e6e58a182c99180e0e9783ae.zip | |
sgreen solutions to challenge 273
Diffstat (limited to 'challenge-273/sgreen/python/ch-2.py')
| -rwxr-xr-x | challenge-273/sgreen/python/ch-2.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/challenge-273/sgreen/python/ch-2.py b/challenge-273/sgreen/python/ch-2.py new file mode 100755 index 0000000000..8bf220971b --- /dev/null +++ b/challenge-273/sgreen/python/ch-2.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import re +import sys + + +import re + + +def b_after_a(s: str) -> bool: + """ + Checks if the string 's' contains the letter 'a' does not appear after a 'b'. + + Args: + s (str): The input string to be checked. + + Returns: + bool: True if the criteria is met, False otherwise. + """ + return re.search(r'^[^b]*b[^a]*$', s) is not None + + +def main(): + result = b_after_a(sys.argv[1]) + print(result) + + +if __name__ == '__main__': + main() |
