나의 풀이
def solution(seoul):
answer = ''
location=seoul.index("Kim")
print(location)
return "김서방은 "+str(location)+"에 있다"
다른 사람의 풀이
def solution(seoul):
return "김서방은 {}에 있다".format(seoul.index('Kim'))
▶ format() 메서드를 이용하자
'프로그래머스(파이썬) > LV.1(파이썬)' 카테고리의 다른 글
나누어 떨어지는 숫자 배열→ or [-1]★, for문 + list compehension (0) | 2022.12.14 |
---|---|
핸드폰 번호 가리기★ (0) | 2022.12.14 |
콜라츠 추측→if-else구문★ (0) | 2022.12.14 |
두 정수 사이의 합 →sum(range(a,b+1)) (0) | 2022.12.14 |
나머지가 1이 되는 수 찾기→ list comprehension 연습★ (0) | 2022.12.14 |