Python Programming - Tricky Questions - Discussion

Discussion Forum : Tricky Questions - General Questions (Q.No. 14)
14.
Consider the following Python code:
def some_function(*args, **kwargs):
    return args, kwargs

result = some_function(1, 2, a=3, b=4)
print(result)
What will be the value of result?
((1, 2), {'a': 3, 'b': 4})
([1, 2], {'a': 3, 'b': 4})
((1, 2), ('a': 3, 'b': 4))
([1, 2], ('a': 3, 'b': 4))
Answer: Option
Explanation:
The function collects positional arguments in a tuple (args) and keyword arguments in a dictionary {kwargs}.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.