Programmers/Python

Level.1 연습문제 > 이상한 문자 만들기

CleanSense 2021. 5. 10. 13:39
728x90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def solution(s):
    index = 0;
    answer = "";
    for spell in s:
        if spell == ' ':
            index = 0;
            answer += spell;
            continue;
        if index % 2 == 0:
            answer += spell.upper();
        else:
            answer += spell.lower();
        index += 1;
 
    return answer;
cs
728x90