20.7k 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

1 Answer

1 vote

Answer:

Here's the code for the print_product function in Python:

def print_product(num1, num2, num3):

product = num1 * num2 * num3

print("The product:", product)

And here's the code to prompt the user for three inputs and call the print_product function:

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)

When you run the code and enter the sample inputs, it should output:

Enter the 1st number: 11

Enter the 2nd number: 9

Enter the 3rd number: 8

The product: 792

User UmutKa
by
8.0k points