As a part of my project, I was working with a dataset where I needed to multiply three different values together. At first glance, it looked like a simple task, but I realized many beginners often struggle with writing clean and reusable code for such cases.
In this tutorial, I will show you how to create a Python program to find product of three numbers. I will also cover multiple methods so you can pick the one that fits your needs.
I always try to simplify concepts so they are easy to understand. Multiplication in Python is easy, but learning different approaches will make you more confident as a programmer.
Method to Find Product of Three Numbers
The product of three numbers simply means multiplying them together. For example:
- If the numbers are 2, 3, and 4, the product is 2 × 3 × 4 = 24.
- If the numbers are 5, 10, and 2, the product is 5 × 10 × 2 = 100.
This operation is very common in real-world scenarios. For instance, imagine you are calculating the total cost of a product in the USA:
- Quantity purchased
- Price per unit
- Sales tax multiplier
Multiplying these three values will give you the final cost.
1 – Use Python’s Multiplication Operator
The simplest way to calculate the product of three numbers in Python is by using the * operator.
Here’s the step-by-step code:
# Python program to find the product of three numbers
# Input three numbers
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
# Calculate product
product = num1 * num2 * num3
# Display result
print("The product of the three numbers is:", product)I executed the above example code and added the screenshot below.

- I take three inputs from the user.
- I multiply them directly using the * operator.
- I print the result.
This method is the most direct and works well for small programs.
2 – Use a Function in Python
In real-world projects, I prefer writing reusable functions in Python. This makes the code easier to maintain and test.
# Python program to find the product of three numbers using a function
def product_of_three(a, b, c):
return a * b * c
# Example usage
result = product_of_three(7, 5, 3)
print("The product of the three numbers is:", result)I executed the above example code and added the screenshot below.

- Functions allow you to reuse the same logic multiple times.
- They make the code cleaner and more organized.
- You can easily test them with different inputs.
For example, if you are building a shopping cart system, you can call this function every time you need to calculate the total price of an item.
3 – Use Python’s math.prod() Function
Python’s math module introduced the prod() function in version 3.8. This is a very efficient way to calculate the product of numbers in an iterable.
import math
# Python program to find the product of three numbers using math.prod()
numbers = [4, 6, 2]
product = math.prod(numbers)
print("The product of the three numbers is:", product)I executed the above example code and added the screenshot below.

- It’s built-in and optimized for performance.
- It works with lists, tuples, and other iterables.
- It’s useful when you need to multiply more than three numbers.
For example, if you are running a financial model where you need to multiply several factors like interest rates, inflation rates, and adjustments, math.prod() is the cleanest solution.
4 – Use a Loop in Python
Sometimes, you may want to use loops instead of built-in functions in Python. This is especially useful if you are just starting with Python and want to understand how multiplication works internally.
# Python program to find the product of three numbers using a loop
numbers = [3, 8, 5]
product = 1
for num in numbers:
product *= num
print("The product of the three numbers is:", product)- It helps beginners understand how multiplication is applied step by step.
- It can be extended to any number of inputs.
- It gives you the flexibility to add conditions while multiplying.
Handle Edge Cases
When writing real-world programs, I always think about edge cases. Here are some things you should consider:
- Zero as an input
- If any of the numbers is 0, the product will always be 0.
- Example: 5 × 0 × 10 = 0.
- Negative numbers
- Multiplying negative numbers follows math rules.
- Example: -2 × 3 × 4 = -24.
- Floating-point numbers
- Python handles decimals as well.
- Example: 2.5 × 3 × 1.2 = 9.0.
- Large numbers
- Python can handle very large integers without overflow.
- Example: 100000 × 200000 × 300000 will still work.
Real-world Example
Let’s take a practical scenario. Suppose you are calculating the total cost of buying laptops in the USA.
- Number of laptops purchased = 3
- Price per laptop = 1200 USD
- Sales tax multiplier = 1.07 (7% tax)
# Real-life example: Calculate total cost of laptops with tax
def total_cost(quantity, price, tax_multiplier):
return quantity * price * tax_multiplier
cost = total_cost(3, 1200, 1.07)
print("The total cost of laptops is: $", cost)Output:
The total cost of laptops is: $ 3852.0This is exactly how the multiplication of three numbers becomes useful in real-world applications.
Which Method Should You Use?
- If you just want a quick calculation → use the * operator.
- If you are writing reusable code → use a function.
- If you are working with lists or many numbers → use math.prod().
- If you are practicing logic building → try the loop method.
When I look back at my early coding days, I remember struggling with simple tasks like multiplication. Over time, I realized that understanding multiple approaches makes you a better problem solver.
Now you know four different ways to find the product of three numbers in Python. Whether you are working on a school project, a financial model, or a shopping cart system, these methods will come in handy.
You may like to read:
- Try except in Python while Loop
- For loop vs while loop in Python
- Python For Loop with Index
- Use Python While with Assignment

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.