One-liner Python


  • 0
    B
    class Solution:
        # @param s, a string
        # @return a boolean
        def isNumber(self, s):
            try: 
                float(s) 
                return True
            except: 
                return False
    

Log in to reply
 

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