n=int(input())
for i in range(n):
num=input()
print(num[::-1])
for custom input it showing correct but when submitting it raise runtime error for EOF.
so try this:
try:
n=int(input())
for i in range(n):
num=input()
print(num[::-1])
except:
pass
but still showing wrong answer whats wrong here? please help
n=int(input()) for i in range(n): num=input() print(int(num[::-1]))
1 Like
why do we use int()
i am new to python .plz. elaborate
because if we did like the other then the no would be stored as string but still the answer will remain same , i think
for t in range (int(input())): #taking number of testcases as input
a,b=map(int,input().split()) #taking 2 numbers in the single line using map function
print(a+b) #printing their sum
Because reverse of 120 as:
- String: 021
- Integer: 21
2 Likes