I have one Recursive function in which Input is a string and in output, we are getting Double Character with Space. What is the logic of this?
def recursive(string): ... ...
Input : "Hello" Output : "HH ee ll ll oo"
Input : "Hello"
Output : "HH ee ll ll oo"
def recursive(string): if not string: return '' else: c = string[0] rest = string[1:] return c + c + ' ' + recursive(rest)
2.1m questions
2.1m answers
60 comments
56.8k users