From 9e35161a649c42a4396a46967e695c556b8bb536 Mon Sep 17 00:00:00 2001 From: kingssullas <64383515+kingssullas@users.noreply.github.com> Date: Fri, 2 Sep 2022 23:14:17 +0600 Subject: [PATCH] Sorry to bother you My submission looks better --- python/string-2/xyz_there.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/python/string-2/xyz_there.py b/python/string-2/xyz_there.py index 6b47103..238951f 100644 --- a/python/string-2/xyz_there.py +++ b/python/string-2/xyz_there.py @@ -1,12 +1,2 @@ -# Return True if the given string contains an appearance of "xyz" where the -# xyz is not directly preceeded by a period (.). So "xxyz" counts but "x.xyz" -# does not. def xyz_there(str): - if str[:3] == "xyz": - return True - - for i in range(1, len(str) - 2): - if str[i-1] != "." and str[i:i+3] == "xyz": - return True - - return False + return str.count('.xyz') != str.count('xyz') #duh, it's so easy! why make it complicated?