Coding Start Python
문자열 뒤집기 def revert(s): if s: s = s[-1] + revert(s[:-1]) return s def revert2(s): return s[::-1] str = "Hello python" print(revert(str)) print(revert2(str)) 문자열 단어 단위 뒤집기 def reverse(s): words = s.split(' ') rev = ' '.join(reversed(words)) return rev strWord = "Hello python" print(reverse(strWord)) 문자열 압축 def compression(s): count, last = 1, "" list_aux = [] for i, c in enumerate(s): if last == c..
2021.03.12