0

Hi I am having some difficulty with assert statements use in functions. In a function definition, if you have a keyword argument intaking a dictionary as a parameter, how can you use just the assert statements to make sure it only accepts 1 of 2 parameters but not both?

i.e.

expDict = {'a':1,'b':2}

The function can only accept a or b but not both

def test(**kwargs):

Drixl
  • 3
  • 1
  • Might be a duplicate: https://stackoverflow.com/questions/19122988/require-one-out-of-two-keyword-arguments – Le Minaw Jan 24 '21 at 00:51
  • 1
    Does this answer your question? [Require one out of two keyword arguments](https://stackoverflow.com/questions/19122988/require-one-out-of-two-keyword-arguments) – Le Minaw Jan 24 '21 at 00:51

0 Answers0