๋ฌธ์
https://school.programmers.co.kr/learn/courses/30/lessons/12930
ํ์ด
# ํ๋ก๊ทธ๋๋จธ์ค 1๋จ๊ณ - ์ด์ํ ๋ฌธ์ ๋ง๋ค๊ธฐ
def solution(s):
answer = ''
idx = 0
for i in range(len(s)):
if s[i] == ' ':
answer += ' '
idx = 0
else:
if idx % 2 == 0:
answer += s[i].upper()
idx += 1
else:
answer += s[i].lower()
idx += 1
return answer
print(solution("try hello world"))
'๐๏ธ Algorithm > โฌ ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
โฌ [Programmers] [Python] [Level1] ํธ๋ ํ์ดํธ ๋ํ (0) | 2023.04.10 |
---|---|
โฌ [Programmers] [Python] [Level1] ์ผ์ด์ฌ (0) | 2023.04.10 |
โฌ [Programmers] [Python] [Level1] ๋ฌธ์์ด ๋ด ๋ง์๋๋ก ์ ๋ ฌํ๊ธฐ (0) | 2023.04.10 |
โฌ [Programmers] [Python] [Level2] ์ฃผ์๊ฐ๊ฒฉ (0) | 2023.04.10 |
โฌ [Programmers] [Python] [Level2] ํ ์ธ ํ์ฌ (0) | 2023.04.10 |