142k views
19 votes
Write a function that takes two arguments, both integers, and prints the product. In the main part of your program (the part that isn’t inside a function), call your function to test it out.

User Brook
by
5.1k points

1 Answer

8 votes

Answer:

def multiply(a, b):

print(a*b)

multiply(2,3)

Step-by-step explanation:

Using python3 :

The program is written using python 3 ;

def represent the statement used at the start of a function.

Multiply is the name given to our function (it could be any other name of interest)

(a, b) are the argument, which represents the two integers the function takes.

print(a * b) = What the function does is to print the product of a and b

multiply(2,3) is used to test out our function by call the name and Giving it two integers to work on. The function will print 6

User JAndy
by
5.3k points