프로그래머스 - LV.0 - 문자열안에 문자열

박종일·2023년 7월 10일
0

프로그래머스 LV.0

목록 보기
14/46

나의 풀이

def solution(str1, str2):
    answer = 0
    if str2 in str1 :
        return 1
    else:
        return 2 

다른 풀이

def solution(str1, str2):
    return 1 if str2 in str1 else 2
def solution(str1, str2):
    if str1.count(str2):
        return 1
    else:
        return 2

문자열 및 리스트 메서드를 알아두는 것도 좋은 풀이가 될 수 있을 것이다.

Python 메서드를 더욱 연구하자!

profile
존경하는 인물: 스토브리그 백승수 단장(남궁민)

0개의 댓글