I want to convert a list
to a string
and using the following lines of code to find my desired string.
My Code
def list_to_string2(values):
num = ""
x=0
x= values[x]
num += str(x)
if len(values) == 0:
return num
else:
return list_to_string2(values) + values.pop(0)
values = [1, 2, 3, 4, 5]
s2 = list_to_string2(values)
print(s2)
Getting an issue like this: RecursionError: maximum recursion depth exceeded while getting the str of an object
I am having trouble with this challenge as I'm in the beginner stage of programming.
Your assistance is highly appreciated. Thank you.