[Python3] ์ซ์ ๋ฌธ์์ด๊ณผ ์๋จ์ด ๋ค๋ฅธ ํ์ด - ๋์
๋๋ฆฌ
ยท
๐ป ์ฝ๋ฉํ
์คํธ/ํ๋ก๊ทธ๋๋จธ์ค
์. ๋๋ฌด ์ด๋ ต๊ฒ ์๊ฐํ๋. ๋ค๋ฅธ ์ฌ๋์ ํ์ด๋ฅผ ๋ดค๋๋ฐ ์ ๊ทํํ์์ ๋๋ฌด ์ธ๋ฐ์์๋ค.ใ
ใ
.. ๋์ฒ๋ผ ๋์
๋๋ฆฌ๋ฅผ ์ฌ์ฉํ๋๋ฐ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ์ ๊ทผํ์ฌ. (๊ทผ๋ฐ ์๊ฐํด๋ณด๋ ๋ด ํ์ด๋ ๊ตณ์ด ๋์
๋๋ฆฌ๋ฅผ ์ฌ์ฉํ ํ์๋ ์์๋ค.. ๋ฐ์ฑ๋ฐ์ฑ..) num_dic = {"zero":"0", "one":"1", "two":"2", "three":"3", "four":"4", "five":"5", "six":"6", "seven":"7", "eight":"8", "nine":"9"} def solution(s): answer = s for key, value in num_dic.items(): answer = answer.replace(key, value) return int(answer) ๊ทธ๋ฅ ๋ฐ๋ก replace๋ก ํด๋ฒ๋ฆฌ๋ฉด ..