aboutsummaryrefslogtreecommitdiff
path: root/challenge-273/sgreen/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-273/sgreen/python/ch-2.py')
-rwxr-xr-xchallenge-273/sgreen/python/ch-2.py29
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()