Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Jewels-and-stones/Python/jewels-and-stones-1.py
Normal file
5
Task/Jewels-and-stones/Python/jewels-and-stones-1.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def countJewels(s, j):
|
||||
return sum(x in j for x in s)
|
||||
|
||||
print countJewels("aAAbbbb", "aA")
|
||||
print countJewels("ZZ", "z")
|
||||
6
Task/Jewels-and-stones/Python/jewels-and-stones-2.py
Normal file
6
Task/Jewels-and-stones/Python/jewels-and-stones-2.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def countJewels(stones, jewels):
|
||||
jewelset = set(jewels)
|
||||
return sum(1 for stone in stones if stone in jewelset)
|
||||
|
||||
print(countJewels("aAAbbbb", "aA"))
|
||||
print(countJewels("ZZ", "z"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue