⊗pyPmFnNPD 13 of 128 menu

Printing Named Parameters as a Dictionary in Python

Named parameters passed to functions can be printed as a dictionary. This is done using the symbol ** and the variable kvargs. Let's declare a function that will simply print two named parameters to the console:

def func(**kvargs): print(kvargs) func(num1=1, num2=2)

Result of code execution:

{'num1': 1, 'num2': 2}

Create a function that takes as parameters numbers from 1 to 7. Name these parameters by days of the week and output them as a dictionary.

Create a function that will take the users' ages as named parameters and output them as a dictionary.

enru