aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-08-14 14:14:15 +0100
committerGitHub <noreply@github.com>2024-08-14 14:14:15 +0100
commitbc64138baadc44768b1895a551cdf48bee10a404 (patch)
tree6805dd3f2dc443526f012064bc2cc675cf65e6ad
parent0008a65c4854312a18e1b85cef208ebd71cebe0c (diff)
parentef48d845cbfcad5fd9d55614ee4a253152be9a33 (diff)
downloadperlweeklychallenge-club-bc64138baadc44768b1895a551cdf48bee10a404.tar.gz
perlweeklychallenge-club-bc64138baadc44768b1895a551cdf48bee10a404.tar.bz2
perlweeklychallenge-club-bc64138baadc44768b1895a551cdf48bee10a404.zip
Merge pull request #10615 from oWnOIzRi/week282
use generator expression, remove intermediate list
-rw-r--r--challenge-282/steven-wilson/python/ch-2.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/challenge-282/steven-wilson/python/ch-2.py b/challenge-282/steven-wilson/python/ch-2.py
index 199cffc157..afc62d82a7 100644
--- a/challenge-282/steven-wilson/python/ch-2.py
+++ b/challenge-282/steven-wilson/python/ch-2.py
@@ -21,7 +21,7 @@ def changing_keys(string):
if not all(c.isalpha() for c in string):
raise ValueError('User should type an aphabetic string')
- return len([item for _, item in groupby(string.casefold())]) - 1
+ return sum(1 for _ in groupby(string.casefold())) - 1
if __name__ == "__main__":