728x90
반응형
https://www.codewars.com/kata/5865918c6b569962950002a1/train/python
Codewars: Train your coding skills
Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential.
www.codewars.com
문자열에서 지정한 문자의 개수를 출력하는 문제이다.
더보기

내 코드
count를 이용하면 쉽게 풀 수 있는 문제이다.
# My Code
def str_count(strng, letter):
return strng.count(letter)
if __name__=='__main__':
answer = str_count('Hello', 'l')
print(answer)
|

반응형
'알고리즘 > 코드워' 카테고리의 다른 글
[python]Find the first non-consecutive number (0) | 2020.03.28 |
---|---|
[python]Find the Difference in Age between Oldest and Youngest Family Members (0) | 2020.03.27 |
[python]Will you make it? (0) | 2020.03.24 |
[python]Removing Elements (0) | 2020.03.20 |
[python]CamelCase Method (0) | 2020.03.15 |