Reverse the Number Issue

I’ve been trying this problem for 30 minutes now and I still can’t get it right. Can anyone analyze my code and tell me what I’m doing wrong? It would be much appreciated. You can find the problem (Reverse the Number) in the EASY difficulty.

Here is my code:
T = int(input())
for j in range(T):
N = input()
string2=’’
for i in range((len(N)-1),-1,-1):
string2 = string2+str(N[i])
print(string2)

You forgot to remove leading zeros from result. here is your AC code.

T=int(input())
for j in range(T):
	N=input()
	string2=""
	for i in range(len(N)-1,-1,-1):
		string2=string2+N[i]
	string2=string2.lstrip("0")
	print(string2)

Also from next time post the question link :grimacing:

1 Like

Thank you very much, it worked! Thank you for your help.

Happy Coding :grinning:.