You are viewing a single comment's thread. Return to all comments →
PYTHON
N = int(input()) while N: N = N - 1 s = input() m = re.search(r'[+-]?(?P<xAxis>\d+(\.\d+)?), [+-]?(?P<yAxis>\d+(\.\d+)?)', s) if m: x = m['xAxis'] xf = float(x) y = m['yAxis'] yf = float(y) if x[0] == '0' and len(x) > 1 and x[1] != '.': print("Invalid") continue if y[0] == '0' and len(y) > 1 and y[1] != '.': print("Invalid") continue if(xf > 90 or yf > 180) : print("Invalid") else: print("Valid") else: print("Invalid")
Seems like cookies are disabled on this browser, please enable them to open this website
Detecting Valid Latitude and Longitude Pairs
You are viewing a single comment's thread. Return to all comments →
PYTHON