Algorithm/프로그래머스 연습 문제
프로그래머스 / 코딩 테스트 / 서울에서 김서방 찾기
Forgotten One
2020. 12. 24. 19:07
문제 설명
문제 해결
문자열 리스트에 "Kim"이라는 문자열이 어디에 위치해 있는지 찾아내면 된다.
index 함수를 이용하여 위치를 반환하도록 만들었다.
def solve(seoul):
return "김서방은 " + str(seoul.index('Kim')) + "에 있다"
def solution(seoul):
answer = solve(seoul)
return answer