문제
모든 모음을 삭제하고 각 자음 앞에 '.'를 삽입하고 모두 소문자로 바꾸어라.
풀이
문자열의 요소 i가 모음 ['a', 'e', 'i', 'o', 'u', 'y'] 중 하나라면 continue로 다음 요소로 넘어간다.
아니라면, 즉 자음이라면 새 문자열에 .i 를 추가한다.
코드
s=input().lower()
new_s=''
for i in s:
if i in ['a', 'e', 'i', 'o', 'u', 'y']: continue
else: new_s+=('.'+i)
print(new_s)
'Codeforces > Python' 카테고리의 다른 글
[Codeforces] 59A - Word (Python) (0) | 2025.05.31 |
---|---|
[Codeforces] 546A - Soldier and Bananas (Python) (0) | 2025.05.29 |
[Codeforces] 266A - Stones on the Table (Python) (0) | 2025.05.28 |
[Codeforces] 791A - Bear and Big Brother (Python) (0) | 2025.05.26 |
[Codeforces] 281A - Word Capitalization (Python) (0) | 2025.05.25 |