I am trying to make a function to delete all the unwanted space before the very first word in a string:
def spacefirst(sentence):
for t in range(len(sentence)):
if t == 0 and sentence[t] == ' ':
sentence = sentence[t+1 :]
else:
sentence = ''.join(sentence)
return sentence
spacefirst(sentence)
Why that recursion is not working?