Skip to Main Content

Python for Basic Data Analysis

Start your data science journey with Python. Learn practical Python programming skills for basic data manipulation and analysis.

What are Arbitrary Keyword Arguments (**kwargs)?

**kwargs works the same as *args buy instead of accepting positional arguments, it accepts keyword arguments such as those from a dictionary (i.e. a dictionary of arguments).


Once again, the important thing here is the function of the unpacking operator (**) which is basically the same as the single asterisk but for dictionaries.

To sum up Arbitrary Arguments:

  • use a single asterisk (*) to unpack iterables
  • and use 2 asterisks (**) to unpack dictionaries

Video Guide

Activity

Use the function above to print the items in the dictionary below:
dict = {"First Name":"John", "Last Name":"Wick","Nickname":"Jojo", "Middle Name":"Candle"}