python - delete space in string with recursive -
i went exam 2-3 hours ago. our teacher asked to:
1) take string sentence user.
2) send string function.
3) our task delete spaces can't use string function , must use recursion.
what's wrong?
def deletespace(name): if(len(name)==0): return "" else: str="" if(ord[name[0]])>chr(65) , ord(name[0])<chr(122): return str+deletespace(name[1:]) name=input("please enter name..") deletespace(name)
the else
clause of second if
missing. return, in case?
Comments
Post a Comment