Print Function Arguments
You are asked to create a Python function
print_args
that prints all its positional arguments and keyword arguments in the order they were received. The function should make use of both *args
and **kwargs
.The input to the function will be any number of positional arguments and keyword arguments.
The function should print each argument on a new line. Positional arguments should be printed first in the order they were received, and then keyword arguments should be printed in the order they were received. Each keyword argument should be printed as
<key>=<value>
.The function should not return anything, but print the arguments as specified above.
Input | Output |
print_args(1, 'apple', key1='hello', key2='world') | 1
apple
key1=hello
key2=world |
Note: The function will be tested with different types and numbers of positional and keyword arguments. The order in which the arguments are printed should match the order in which they were passed to the function.
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB