[Python3] valid numbers
Algo\nThe key is to deal with extraneous zeros. Below rule gives the what\'s required\n1) if a string has length 1, return it;\n2) if a string with length large
Algo\nThe key is to deal with extraneous zeros. Below rule gives the what\'s required\n1) if a string has length 1, return it;\n2) if a string with length larger than 1 and starts and ends with 0, it cannot contain valid number;\n3) if a string starts with 0, return `0.xxx`;\n4) if a string ends with 0, return `xxx0`;\n5) otherwise, put decimal point in the `n-1` places. \n\nImplementation \n```\nclass Solution:\n    def ambiguousCoordinates(self, s: str) -> List[str]:\n        s = s.strip("(").strip(")")\n        \n        def fn(s): \n            """Return valid numbers from s."""\n            if len(s) == 1: return [s]\n            if s.startswith("0") and s.endswith("0"): return []\n            if s.startswith("0"): return [s[:1] + "." + s[1:]]\n            if s.endswith("0"): return [s]\n            return [s[:i] + "." + s[i:] for i in range(1, len(s))] + [s]\n        \n        ans = []\n        for i in range(1, len(s)): \n            for x in fn(s[:i]):\n                for y in fn(s[i:]): \n                    ans.append(f"({x}, {y})")\n        return ans  \n```
['Python3']