Python Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 33)
33.
What will be the output of the following code snippet?
def add(a, b):
    return a + b

numbers = [1, 2, 3, 4]
result = add(*numbers)
print(result)
10
1234
[1, 2, 3, 4]
Error
Answer: Option
Explanation:
The *numbers syntax unpacks the list, and the function add adds all elements together.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.