Coding/Python
[Programmers] lv.1 이상한 문자 만들기 (python)
HeYStRanGeR
2023. 5. 15. 09:54
(23.05.15)
이것도 왜인지 모르게 깃허브 자동 업로드에 오류가 났다!!!
https://school.programmers.co.kr/learn/courses/30/lessons/12930#
고려해야할 테스트 케이스가 많은 문제였다.
def solution(s):
answer = ''
index = 0
for i in range(len(s)):
if i==0 and s[i]==' ':
answer += ' '
elif i>0 and s[i]==' ':
answer += ' '
index = 0
elif index%2 == 0:
answer += s[i].upper()
index += 1
elif index%2 != 0:
answer += s[i].lower()
index += 1
return answer
728x90