Hi, I’ve coded a dictionary with 2 lambda functions in, which do the calculations for this function. To my surprise, it worked! But then I tried adding a third pair to the dict, to handle errors. Basically its (supposed to be) a regex statement that looks for all characters that aren’t + or -; Unfortunately I get ‘invalid syntax’ pointing at the ^ in the regex.

```
import re
inpt = "5870 n 2309"
lst = inpt.split()
calc = {'+': lambda x, y: x + y, '-': lambda x, y: x - y,[^+-]*: print(error) }
ans = (calc[lst[1]](int(lst[0]),int(lst[2])))
print(ans)
```

Is using regex as a dictionary key not allowed? Or am I just doing it wrong? I tried putting the regex in quotes; didn’t change anything…

Thanks.