μΉ΄μ΄μ¬λ₯΄ μνΈ - λ¬Έμ νμ΄
μΉ΄μ΄μ¬λ₯΄ μνΈλ₯Ό νμ΄μ¬μΌλ‘ ꡬνν 2κ°μ§ λ°©λ²μ νμΈν΄ 보μΈμ.
λ°©λ² 1
def solution(text, shift): alphabet = 'abcdefghijklmnopqrstuvwxyz' result = '' for char in text: if char.isalpha(): index = alphabet.index(char.lower()) shifted_index = (index + shift) % 26 shifted_char = alphabet[shifted_index] result += shifted_char.upper() if char.isupper() else shifted_char else: result += char return result
μ¬μ© μμ
μ
μΆλ ₯ μμ
result = solution("abc", 3) print(result) # μΆλ ₯: "def"
Guidelines
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help