Question: Given the following function: def reverse _ str ( st , pos = 0 ) : Returns a new string that is

Given the following function:
def reverse_str(st, pos=0):
"""
Returns a new string that is the reverse of st
When first called, the pos parameter must be zero
"""
if pos == len(st):
return ""
return reverse_str(st, pos+1)+ st[pos]
If a user were to call the function like this
reverse_str("recursion")
What would be the value of pos in the first call?
Group of answer choices

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!