Sunday, February 6, 2022

Break Camelcase Python

Complete the solution so that the function will break up camel casing, using a space between words.

Example
"camelCasing"  =>  "camel Casing"
"identifier"   =>  "identifier"
""             =>  ""

def solution(s):
    new=''
    for i in s:
        if i.islower():
            new += i 
        else:
            new += ' '+i
    return new



def solution(s):
    return ''.join(' ' + c if c.isupper() else c for c in s)

Training on Break camelCase | Codewars



Related Posts


No comments :

Post a Comment