Join method not working


#1
 def reverse(text):
     reversed_text = []
     index = len(text)
         while index > 0:
             reversed_text.append(text[index - 1])
             index -= 1
         return reversed_text.join(" ")

Why doesn't my .join method work? I can never seem to get it to work properly. I can get it to return a list of letters (i.e [a, b, c, d]) rather than the reversed string (i.e [dcba]) I tried to use the join method taught in a previous lesson, but it keeps telling me that join isn't an attribute of the list.

Anybody know what I should do?


#2

@rubyjumper19934

Join is a string method, meaning you have to actually use it on a string.

Example:

a = 'String'
b = 'bean'
print(' '.join(a, b))