Robotics & Artificial Intelligence
Which keyword is used to define function with variable length arguments?
- *args
- **kwargs
- *var
- Both a and b
Python Functions
1 Like
Answer
Both a and b
Reason — Python allows functions to accept a variable number of arguments using *args and **kwargs.
Answered By
2 Likes
Related Questions
What would be output of the following code snippet?
def multiply(x, y=2): return x * y result = multiply(5) print(result)- 5
- 10
- 2
- Error
In the following code snippet, what does 5 in the argument list represent?
def add(x, y=5): return x + y- return value
- default value
- input value
- None of these
Which of the following is not a built-in function in Python?
- input()
- print()
- len()
- add()
What would be the return type of the following function in Python?
def mul(x, y): return x * y result= multiply(5, 2) print(result)- int
- float
- char
- string