compilation error in python

hello everyone,i tried this question with python…this is my first ever question in python and i am getting weird kind of error please let me know where i am wrong…link to solution

As you are working in python, you must be knowing , how important indentation is. In python, a prticular block is identified by its indented block only. Se, be very careful with it. I changed your code to this:

import sys
data=sys.stdin

def gcd(a,b):
	if b==0:
	  return a
	else:
	  return gcd(b,a%b)
	
	
t=int(data.readline())
while(t):
  print(t)
  #a,b = map(int,data.readline().split(''))
  #print a,b
  #print gcd(a,b)
  t-=1

Note the comments above, the above works fine. If i’ll now uncomment the above a,b line where you are reading input, it shows RTE i.e. mistake in your way of reading input as you can check by printing the values of a and b. Use this:

  str=raw_input()
  str=str.split(' ')
  a=str[0]
  b=str[1]
1 Like