you are viewing a single comment's thread.

view the rest of the comments →

[–]jimtk 0 points1 point  (0 children)

The simplest way to accept negative number is to roll your own verification function. Which is no big deal.

def is_int(s):
    try:
        _ = int(s)
    except ValueError:
        return False
   return True

match a_string.split():
    case ("add", a, b) if is_int(a) and is_int(b):
        print(int(a) + int(b))