코딩
-
[Algorithm - 프로그래머스] Python 숫자 문자열과 영단어Programming/Algorithm 2021. 10. 21. 00:40
문제 (LV.1) https://programmers.co.kr/learn/courses/30/lessons/81301 코드 def solution(s): answer = '' num = {"zero" : '0', "one" : '1', "two" : '2', "three" : '3' , "four" : '4', "five" : '5', "six" : '6', "seven" : '7' , "eight" : '8', "nine" : '9' } tmp_words = "" for i in s: if i.isdigit(): answer += i continue tmp_words += i if tmp_words in num.keys(): # dictionary key 안에 단어가 존재한다면 answer += nu..