프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(s):
answer = 0
num = ['zero','one','two','three','four','five','six','seven','eight','nine']
for i in range(len(num)):
if num[i] in s:
s = s.replace(num[i], str(num.index(num[i])))
answer = int(s)
return answer
def solution(s):
answer = s
num = {'zero':'0', 'one':'1', 'two':'2', 'three':'3', 'four':'4'
,'five':'5', 'six':'6', 'seven':'7', 'eight':'8', 'nine':'9'}
for k, v in num.items():
answer = answer.replace(k, v)
return int(answer)
'코딩테스트 > 프로그래머스' 카테고리의 다른 글
프로그래머스 방문 길이 python 파이썬 (0) | 2022.10.08 |
---|---|
프로그래머스 스킬트리 python 파이썬 (0) | 2022.10.08 |
프로그래머스 문자열 내 마음대로 정렬하기 (0) | 2022.10.08 |
프로그래머스 영어 끝말잇기 python 파이썬 (0) | 2022.10.08 |
프로그래머스 최솟값 만들기 python 파이썬 (0) | 2022.10.07 |