https://school.programmers.co.kr/learn/courses/30/lessons/12919?language=python3
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
처음에 이렇게 했었는데 굳이 index를 쓰면 if를 쓰지않아도 되는데..
def solution(seoul):
if 'Kim' in seoul:
return '김서방은 %d에 있다' %(seoul.index('Kim'))
list.index() : list에서 찾고자 하는 값의 index값을 반환
'~~~~~~~~~ %d %s' %(3,'Kim) 이런식으로 string return
'~~~~~~~ {} ~~~~ {}'.format(3, 'Kim') 두개 다 똑같은 방법
https://dreamjy.tistory.com/93
파이썬 python list 찾기
파이썬 python list 값 요소 찾기 python list에서 원하는 값(요소)를 찾는 방법에 대해 알아보겠습니다. list안의 값을 찾는 법은 여러 방법으로 구현할 수 있습니다. 각각의 방법에 대해 비교해보시고
dreamjy.tistory.com
https://stackoverflow.com/questions/31807128/return-formatted-string-in-python
Return formatted string in Python
I have a string: testString = """ My name is %s and I am %s years old and I live in %s""" I have code that finds these three strings that I want to input into testString. How do I do that? In Jav...
stackoverflow.com
def solution(seoul):
return '김서방은 %d에 있다' %(seoul.index('Kim'))
[코딩테스트 입문] 나누어 떨어지는 숫자 배열(Python3) (0) | 2023.01.03 |
---|---|
[코딩 테스트입문] 핸드폰 번호 가리기(Python3) (0) | 2023.01.03 |
[코딩테스트 입문] 콜라츠 추측(Python3) (0) | 2023.01.03 |
[코딩테스트 입문] 두 정수 사이의 합(Python3) (0) | 2023.01.03 |
[코딩테스트 입문] 나머지가 1이 되는 수 찾기(Python3) (0) | 2023.01.03 |