# AC Python code

• Well, in this problem, the only thing you need to do is as follows

``````while not pass:
see the not-pass test case
submit again
return Done
``````

@_@. Below is my code

``````class Solution(object):
def isNumber(self, s):
"""
:type s: str
:rtype: bool
"""
n = len(s)
if n == 0:  return False
sign, point, exp, found = False, False, False, False
i = 0
# for left blanks
while i<n and s[i]==' ':    i += 1
# for the numeric body
while i<n :
if s[i]>='0'and s[i]<='9': found, i = True, i+1
elif ((not sign and not found and (not point or point and exp)) or (sign and not found and exp)) and (s[i]=='+' or s[i]=='-'):   sign, found, i = True, False, i+1
elif (not point) and (not exp) and (s[i]=='.'):   point, i = True, i+1
elif found and (not exp) and (s[i]=='e'): exp, found, i = True, False, i+1
elif found and s[i]==' ':   break
else:   return False
# for right blanks
while i<n and s[i]==' ':    i += 1
if i>=n and found: return True
else: return False

``````

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.