137k views
5 votes
Write a function definition called multiply that takes two integer parameters to perform the operation described in the first sentence. Return the answer to the calling function.

a. def multiply(x, y): return x + y
b. def multiply(x, y): return x - y
c. def multiply(x, y): return x * y
d. def multiply(x, y): return x / y

1 Answer

4 votes

Final answer:

The appropriate function to multiply two integers in Python is 'def multiply(x, y): return x * y'. This uses the multiplication operator, which is an asterisk (*).

Step-by-step explanation:

The correct function definition that multiplies two integer parameters, x and y, and returns the result to the calling function is:

def multiply(x, y): return x * y

The operation for multiplication in Python is represented by the asterisk (*). The functions provided in the other options perform addition, subtraction, and division, which are not the requested operations for this function. Hence, the correct choice is c. def multiply(x, y): return x * y.

User Neoascetic
by
7.8k points