Robotics & Artificial Intelligence
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
Python Functions
2 Likes
Answer
int
Reason — The return type of a function depends on the type of value returned by the return statement. In the given function, the statement return x * y returns the product of two integer values. Since the multiplication of integers results in an integer value, the return type of the function is int.
Answered By
3 Likes
Related Questions
Which keyword is used to define function with variable length arguments?
- *args
- **kwargs
- *var
- Both a and b
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 is_positive(number): if number > 0: return True else: return False- int
- float
- bool
- char
Which of the following keywords is used to create a user-defined function?
- None
- define
- def
- func