jeeyeonLIM / coding_test

Let's practice the coding test!
1 stars 0 forks source link

[연습문제] 서울에서 김서방 찾기 #48

Open jeeyeonLIM opened 3 years ago

jeeyeonLIM commented 3 years ago

문제 설명

제한 사항

입출력 예

seoul return
["Jane", "Kim"] 김서방은 1에 있다
jeeyeonLIM commented 3 years ago

나의코드

def solution(seoul):
    answer = ''
    for i in range(len(seoul)):
        if seoul[i] == "Kim":
            n=i
    return "김서방은 %d에 있다" %n
jeeyeonLIM commented 3 years ago

모범답안

def solution(seoul):
    return "김서방은 {}에 있다".format(seoul.index('Kim'))