7. Reverse - Error despite the code working elsewhere



Not sure what is going on here, but whenever I use the code below, CodeAcademy spits out "Oops, try again. Your function fails on reverse("Python!"). It returns "None" when it should return "!nohtyP"."

I have tried this several times using the python that is already loaded on my computer, and it works perfectly. What is going on?

def reverse(text):

	text = str(text)
	charList = []
	reverseList = []	

	for i in text: #Runs through the text string and appends each letter to the forwards-list
	print "DEBUG: ", charList

	n = len(text)-1

	while n >= 0: #runs through the forwards-list to reverse them
		n -= 1
	print "DEBUG: ", reverseList

	print ''.join(reverseList) #this should print out the reverse of the input


Never mind. figured it out.

Where I had

print ''.join(reverseList)

it should have read

return ''.join(reverseList)