하루에 하나-13

정인창·2021년 9월 21일
0

코딩테스트 연습

목록 보기
13/19

def solution(seoul):
    return '김서방은 {}에 있다'.format(seoul.index('Kim'))
  • list의 index 함수를 이용해 'Kim'의 위치를 찾고 format함수를 이용해서 {} 안을 채워줌.
  • Kim은 반드시 seoul 안에 있고, 중복은 없음!

profile
Data science

0개의 댓글