Print reverse of a string using recursion | Function to print reverse of the passed string ; Driver program to test above function
def reverse ( string ) : NEW_LINE INDENT if len ( string ) == 0 : NEW_LINE INDENT return NEW_LINE DEDENT temp = string [ 0 ] NEW_LINE reverse ( string [ 1 : ] ) NEW_LINE print ( temp , end = ' ' ) NEW_LINE DEDENT string = " Geeks ▁ for ▁ Geeks " NEW_LINE reverse ( string ) NEW_LINE