Reverse, instructions are lacking


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/1?curriculum_id=4f89dab3d788890003000096#

It works correctly

It took me two days of researching to figure this out by myself with only using the methods and functions showed to us in previous exercises. True, I learned a lot. However, I think improvements can be made on the instructions. Definitely, more guidance, tips, and references to previous exercises are needed.


def reverse(x):
	a = []
	for s in x:
		a.append(s)
	length = len(a)
	act_length = length - 1
	half_length = length / 2
	for f in range(0, half_length):	
		end_a = a[act_length]
		a[act_length] = a[f]
		a[f]= end_a
		act_length -= 1
	return ''.join(a)
reverse("text")


#2

To me this looks much more complicated than it has to be.
The way I did it was first think "how can I iterate through a string in reverse, pick up each element and put them in one variable, so I can finally .join the variable. This was my solution:

def reverse(text):
result = []
n = len(text)
while n > 0:
result += text[n-1]
n -= 1
return ''.join(result)

ps. I can't get this stuff to indent :frowning: