반응형 알고리즘/프로그래머스 level 1,272 [파이썬🐍] 프로그래머스 : 문자열 내림차순으로 배치하기 def solution(s): answer=sorted(s,reverse=True) return "".join(answer) 2021. 4. 20. [파이썬🐍] 프로그래머스 : 문자열 내 p와 y의 개수 def solution(s): p,y=0,0 p=s.count('p')+s.count('P') y=s.count('y')+s.count('Y') if p!=y: return False return True def solution(s): return s.lower().count('p')==s.lower().count('y') 문자열을 모두 소문자로 바꿔주고 한번애 갯수를 세니 아주 간결해진 코드! 2021. 4. 20. [파이썬🐍] 프로그래머스 : 문자열 내 마음대로 정리하기 def solution(strings, n): answer = [] strings.sort() answer = sorted(strings,key = lambda x:x[n]) return answer 2021. 4. 20. [파이썬🐍] 프로그래머스 : 두 정수 사이의 합 def solution(a, b): answer=0 if a 2021. 4. 20. 이전 1 ··· 11 12 13 14 15 16 17 18 다음 반응형