중복된 문자 제거
https://school.programmers.co.kr/learn/courses/30/lessons/120888
def solution(my_string):
answer = ''
for i in my_string:
if not i in answer:
answer += i
return answer
합성수 찾기
https://school.programmers.co.kr/learn/courses/30/lessons/120846
def solution(n):
answer = 0
if n == 1 or n == 2 or n == 3:
return 0
for i in range(2, n+1):
for j in range(2, i):
if i % j == 0:
answer += 1
break
return answer
모스부호
https://school.programmers.co.kr/learn/courses/30/lessons/120838?language=python3
def solution(letter):
answer = ''
morse = { '.-':'a','-...':'b','-.-.':'c','-..':'d','.':'e','..-.':'f',
'--.':'g','....':'h','..':'i','.---':'j','-.-':'k','.-..':'l',
'--':'m','-.':'n','---':'o','.--.':'p','--.-':'q','.-.':'r',
'...':'s','-':'t','..-':'u','...-':'v','.--':'w','-..-':'x',
'-.--':'y','--..':'z'}
for i in letter.split(' '):
answer += morse.get(i)
return answer
A로 B만들기
https://school.programmers.co.kr/learn/courses/30/lessons/120886
sorted()하고 .sort()하고 헷갈리지 말자
def solution(before, after):
if sorted(list(before)) == sorted(list(after)):
return 1
else:
return 0