Solution Review: Length of a String
This review provides a detailed analysis of the solution to find the length of a string recursively.
We'll cover the following...
Solution: Using Recursion
Python 3.5
def recursiveLength(testVariable) :# Base Caseif (testVariable == "") :return 0# Recursive Caseelse :return 1 + recursiveLength(testVariable[1:])# Driver CodetestVariable = "Educative"print (recursiveLength(testVariable))
Explanation
The base case for this solution will test for an empty string "". If the string is empty we return ...