-
[프로그래머스] 문자열 뒤집기 - python코딩테스트 2023. 12. 11. 23:35
https://school.programmers.co.kr/learn/courses/30/lessons/120822
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr

def solution(my_string): list_s = list(my_string) list_s.reverse() answer = ''.join(list_s) return answerhttps://1ooflower.tistory.com/69
[PYTHON] 뒤집기 함수 - reverse(), reversed()
reverse와 reversed는 리스트를 역순으로 바꾸는데 사용 reverse() : 리스트 자체를 역순으로 변경 a = [1,2,3,4,5] a.reverse() print(a) [5, 4, 3, 2, 1] reversed() : 역순으로 뒤집은 복사본을 반환 a = [1,2,3,4,5] b = list(r
1ooflower.tistory.com
https://1ooflower.tistory.com/68
[PYTHON] 리스트를 문자열로 합치기- join()
join() : 리스트나 튜플과 같은 iterable 객체의 요소들을 문자열로 결합 a_list = ['a', 'b', 'c'] result = ' '.join(a_list) #공백으로 구분된 문자열로 print(result) #a b c type(result) #문자열타입 a b c str a_list = ['a', '
1ooflower.tistory.com
def solution(my_string): return my_string[::-1]def solution(my_string): return ''.join(list(reversed(my_string)))'코딩테스트' 카테고리의 다른 글
[프로그래머스] 짝수 홀수 개수- python (0) 2023.12.13 [프로그래머스] 직각삼각형 출력하기 - python (0) 2023.12.13 [프로그래머스] 배열 뒤집기 - python (0) 2023.12.09 [프로그래머스] 아이스 아메리카노 - python (0) 2023.12.09 [프로그래머스] 옷가게 할인 받기 - python (0) 2023.12.09