KnowledgeBoat Logo
|

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)
  1. int
  2. float
  3. char
  4. 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