Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Data Science by (18.4k points)

The context is complex to explain, but tl;dr I have to deal with the production system where I cannot install libraries and one of my libraries expects illegal keyword arguments as the input.

def hack_me(**kwargs):

   if kwargs.get("hack:/me") is not None:


The objective is that my function above, without modifying it, prints Hacked!.

1 Answer

0 votes
by (36.8k points)

While your regular arguments can't have any form for their name, expanded arguments using a same syntax as in the function signature (i.e. **args) can.

>>> args = {'hack:/me': True}

>>> hack_me(**args)


Want to be a Data Science expert? Come and join this Data Science Courses

Browse Categories