취준시절/프로그래머스

[프로그래머스] 가운데 글자 가져오기 - Python

MAYMIN 2021. 7. 9. 01:14
728x90
SMALL
def solution(s):
    answer = ''
    if len(s)%2==0:
        answer=s[int(len(s)/2-1):int(len(s)/2+1)]
    else:
        answer=s[int(len(s)/2-0.5)]
    return answer
728x90
LIST