def is_math_exp(str):
 charset = set('0123456789abcdefx+-*/%^')
 opers = set('+-*/%^')
 exp = set(str.lower())
 return (((exp & opers) != set()) and ((exp - charset) == set()))

def is_math_exp ( str ) : charset = set ( '0123456789abcdefx+-*/%^' ) opers = set ( '+-*/%^' ) exp = set ( str . lower ( ) ) return ( ( ( exp & opers ) != set ( ) ) and ( ( exp - charset ) == set ( ) ) )
check if a string is a math exprssion .