Ad
Code
Diff
  • def solution(s):
        return "".join([f" {n}"if n.isupper() else n for n in s])
    • def solution(s):
    • s = list(s)
    • for i in range(len(s)):
    • if s[i].isupper():
    • s[i] = f" {s[i]}"
    • return "".join(s)
    • return "".join([f" {n}"if n.isupper() else n for n in s])
Code
Diff
  • def solution(s):
        s = list(s)
        for i in range(len(s)):
            if s[i].isupper():
                s[i] = f" {s[i]}"
        return "".join(s)
    • def solution(s):
    • newStr = ''
    • for i in s:
    • if i.isupper():
    • newStr += f" {i}"
    • else:
    • newStr += i
    • return newStr
    • s = list(s)
    • for i in range(len(s)):
    • if s[i].isupper():
    • s[i] = f" {s[i]}"
    • return "".join(s)
Code
Diff
  • def solution(s):
        newStr = ''
        for i in s:
            if i.isupper():
                newStr += f" {i}"
            else:
                newStr += i
        return newStr
    • def solution(s):
    • newStr = ''
    • for i in s:
    • newStr += i
    • if i.isupper() == True:
    • newStr = newStr[:-1]
    • newStr += ' ' + i
    • if i.isupper():
    • newStr += f" {i}"
    • else:
    • newStr += i
    • return newStr