[Programmers] 가운데 글자 가져오기
Python
def solution(s):
if len(s) % 2 != 0:
return s[int(len(s)/2)]
else:
return s[int(len(s)/2) - 1:int(len(s)/2) + 1]
def solution(s):
if len(s) % 2 != 0:
return s[int(len(s)/2)]
else:
return s[int(len(s)/2) - 1:int(len(s)/2) + 1]
댓글남기기