= fact( def fact( )if = return elsereturn fact( - def fact( )if = nreturn elsereturn fact( - def fact( )if = return nelsereturn fact( - def fact( )if = return elsereturn fact( - def fact( )if = return else return fact( - = def fact( )if = return elsereturn fact( - figure recursive computation of examplestring reversal python lists have built-in method that can be used to reverse the list suppose that you want to compute the reverse of string one way to handle this problem effectively would be to convert the string into list of charactersreverse the listand turn the list back into string using recursionhoweverwe can easily write function that computes the reverse directlywithout having to detour through list representation the basic idea is to think of string as recursive objecta large string is composed out of smaller objectswhich are also strings in factone very handy way to divide up virtually any sequence is to think of it as single first item that just happens to be followed by another sequence in the case of stringwe can divide it up into its first character and "all the rest if we reverse the rest of the string and then put the first character on the end of thatwe'll have the reverse of the whole string let' code up that algorithm and see what happens def reverse( )return reverse( [ :] [ notice how this function works the slice [ :gives all but the first character of the string we reverse the slice (recursivelyand then concatenate the first character ( [ ]onto the end of the result it might be helpful to think in terms of specific example if is the string "abc"then [ :is the string "bcreversing this yields "cband tacking on [ yields "cbathat' just what we want unfortunatelythis function doesn' quite work here' what happens when try it outreverse("hello"