whats wrong in my code ?

i wrote a code in python 3 of Chef And Operators
but whenever i submit my code it is shows me result = wrong answer
i checked code many times but didn’t find any mistake
please please please help me
here is my code

for i in range(int(input())) :
if ls[0]<ls[1] :
elif ls[0]>ls[1] :
elif ls[0]==ls[1] :

Well, 2 mistakes.

  1. Python heavily relies on indentation. Therefore, a ‘tab’ is required before every line after the ‘for’ statement. [I think the tabs disappeared when you pasted the code; because with such an error the verdice won’t be a WA]
  2. ‘split()’ splits the input string into a set of strings. You need to convert them to integers before comparing them…

Just for formality: CodeChef: Practical coding for everyone

Thanks, You are right, tabs disappeared when i pasted the code here. And code worked when i convert str to int before comparing ls[0] & ls[1] you really helped a lot

1 Like