Reverse Program


#1

Hi There,
Could anyone confirm whether there is something wrong with this reverse program ?
Its running fine and producing the correct reverse output but the Python course not moving forward. The NEXT button still disable state.


def reverse(text):
	q = []
	out = []

	for i in range(0,len(text),1):
		z = (text[i:i+1])
		q = q + [z]
	
	l_e=len(q)-1
	
	while (l_e>=0):
		out.append(q[l_e])
		l_e = l_e - 1

	
	a = ''.join(out)
	return a
		
	

input= raw_input("Text input: ")
print reverse(input)


#2

can you show a screenshot? Its working fine for me

Otherwise, refresh page or try a different browser. Sometimes there are problem with raw_input, you can also attempt to remove raw_input and just pass in a string to the function call, see if that works


#3

Yes It working fine now. I had to re-lunch the website. Seems some glitches was there.
Thank you for checking.


#4

If you like a challenge, refactor your code. Does it really need two loops? We only need to reverse, so a single loop should do


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.