33.9k views
3 votes
Write a function named print_product that accepts three numbers as parameters and prints the product. First, write the print_product function. Then, prompt the user for three inputs, and call your print_product function on those inputs.

Sample Run
Enter the 1st number: 11
Enter the 2nd number: 9
Enter the 3rd number: 8
The product: 792

User Keeley
by
5.9k points

1 Answer

4 votes

Answer:

Here is the code to implement the function print_product:

def print_product(num1, num2, num3):

product = num1 * num2 * num3

print(f"The product: {product}")

num1 = int(input("Enter the 1st number: "))

num2 = int(input("Enter the 2nd number: "))

num3 = int(input("Enter the 3rd number: "))

print_product(num1, num2, num3)

Step-by-step explanation:

This will ask the user to enter three numbers, and then call the print_product function with those numbers as arguments. The function will then compute the product of the three numbers and print the result.

User Andrey Ozornin
by
6.0k points