Why does "c" in the for loop is not incrementing?
def solution(s):
for c in range(len(s)):
if s[c] == s[c].upper():
s = s[:c] + ' ' + s[c:]
c += 1
return s
print(solution('helloWorld'))
The output should be "hello World"
, however, when i add a space " "
i also increment the c
, but it doesn't works.
Current output is 'hello World'