[Programmers] - 이상한 문자 만들기 (Level 1)
연습문제
LEVEL : 1
문제링크
s = "try hello world "
def solution(s):
s = s.split(' ')
answer = []
for t in s:
tmp = ''
for i in range(len(t)):
if i%2==0: tmp+=t[i].upper()
else: tmp+=t[i].lower()
answer.extend(tmp+' ')
if s[-1] == ' ':
return ''.join(answer)
else:
return ''.join(answer[:-1])
solution(s)
'TrY HeLlO WoRlD '
Comments