## Transcribed Text

1. Write a recursive function reversible() that takes a list as a parameter and returns True if the list is
the same forward and backward and False otherwise. A list is the same forward and backward if items
viewed from the front to back and back to front are the same. A list with 0 or 1 items is also defined to
be reversible. You may not use any list operator or functions other than len(), indexing (lst[i] for an
integer i), or slicing (lst[i:j] for non-negative integers i and j). In particular, the list function reverse() or
negative indices that reverse a list should not be used under any circumstances. The function should not
modify the list passed as a parameter. The following shows how the function behaves on several sample
parameters:
Write a recursive function recListSum() that takes an arbitrarily nested list as a parameter
and returns the sum of the numbers in the list. You are not allowed to use any list methods in
your function other than indexing (e.g. lst[i] for some integer i), slicing (e.g. lst[i:j] for some
integers i and j), or len(). The function may not use a loop. Solutions that use built-in functions
rather than recursion to solve the problem will earn very little credit. You may assume that the
initial value given to the function is a list, and your function does not have to behave in any
reasonable way when given something other than a list as a parameter. The list may contain
values of any type and you must only take the sum of the ones that are integers or floating
point values. The type() function is helpful in determining what values can be found in the list.
Numbers found within other collections (tuples, dictionaries, etc.) should not be included in the
sum. The following shows the behavior of the function on some sample parameters. Please
remember that these examples are just that. Your function must work correctly on all valid
parameters, and you may not make any assumptions about the number of nested sublists or
the depth of the nesting in the list provided as a parameter to the function:
3. Write a recursive function recStringCount() that takes an arbitrarily nested list as a
parameter and returns the number of floating point values that are found in the list. Recall that
you can determine whether an item is a string point value by writing
type(item) == string and whether an item is a list by writing type(item) == list. The function
should not use any loops. The only list functions you are allowed to use are len(), indexing
(lst[i] for an integer i), or slicing (lst[i:j] for integers i and j). The following shows several sample
runs of the completed function:
4. Write a recursive function dirPrint() that takes as parameters a pathname of a folder as a
string and an integer indent and prints to the screen the pathname of every subfolder
contained in the folder, directly or indirectly. The subfolder path names should be output with
an indentation that is proportional to their depth with respect to the topmost folder and should
use the parameter indent to achieve this. The example below illustrates the execution of the
function on several sample folders. All of the sets of folders (with files, although they are
irrelevant for this question) can be found in the zip file containing the template and posted to
D2L:

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.

import os

def recStringCount(lst):

if type(lst) != list or len(lst) == 0:

return 0

elif type(lst[0]) == str:

if len(lst) > 1:

return 1 + recStringCount(lst[1:])

else:

return 1

elif type(lst)...