diff options
| author | Pok <pok@goyangi> | 2025-09-29 15:13:16 +0700 |
|---|---|---|
| committer | Pok <pok@goyangi> | 2025-09-29 15:13:16 +0700 |
| commit | 404898b309c5d6c08eff2f0f43c9553cf0f1493d (patch) | |
| tree | cf1c5543986a8ebbd4693ad3ecb5f5aa191c9c03 | |
| parent | c6e63c2bc0b7f40515c82bf832058d9da016babe (diff) | |
| download | perlweeklychallenge-club-404898b309c5d6c08eff2f0f43c9553cf0f1493d.tar.gz perlweeklychallenge-club-404898b309c5d6c08eff2f0f43c9553cf0f1493d.tar.bz2 perlweeklychallenge-club-404898b309c5d6c08eff2f0f43c9553cf0f1493d.zip | |
pwc341 - minor update
| -rw-r--r-- | challenge-341/pokgopun/python/ch-1.py | 4 | ||||
| -rw-r--r-- | challenge-341/pokgopun/python/ch-2.py | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/challenge-341/pokgopun/python/ch-1.py b/challenge-341/pokgopun/python/ch-1.py index 0987822638..94628e9a44 100644 --- a/challenge-341/pokgopun/python/ch-1.py +++ b/challenge-341/pokgopun/python/ch-1.py @@ -57,6 +57,10 @@ def bk(string: str, keys: tuple[str]) -> int: cnt += 1 return cnt +def bk0(string: str, keys: tuple[str]) -> int: + keys = set(keys) + return sum( 1 if keys.intersection(set(e.lower())) == set() else 0 for e in string.split(" ") ) + import unittest class TestBk(unittest.TestCase): diff --git a/challenge-341/pokgopun/python/ch-2.py b/challenge-341/pokgopun/python/ch-2.py index 621c8b3776..70eb41600f 100644 --- a/challenge-341/pokgopun/python/ch-2.py +++ b/challenge-341/pokgopun/python/ch-2.py @@ -49,9 +49,8 @@ SO WHAT DO YOU THINK ? ### solution by pokgopun@gmail.com def rp(string: str, char: str) -> str: - string i = string.find(char) - if i == -1: + if i < 1: return string return "".join(reversed(string[:i+1])) + string[i+1:] |
