How To Multiply Without Using * In Python

Do you want to know how to multiply without using * in Python? This article will show you how you can multiply two numbers without using * in Python.

It is quite easy to do it if you do not want to use the * sign to multiply directly. The first approach you can follow is to add the input values to the multiple values and this will provide the product of the two numbers.

Using Addition of One Number In a Loop till Other Number

Let us see in the below example code how you can do that without using * in Python.

#Initializing Two numbers
number1 = 5
number2 = 7

#Now you need to find 5*7 hence we can either
#loop five times and add seven or loop seven time
#and add five.
mutliValue = 0

#loop till mutliplcation is found
for i in range(0, number1):
    mutliValue += number2

#Printing the Mutliplaction of Two Number
print("The multiplaction of {} and {} is {}.".format(number1, number2 ,mutliValue))

Output:

The multiplaction of 5 and 7 is 35.

As you can see using the above code we were able to get the multiplication of two numbers without using an asterisk (*) sign. In the above method, all we did is execute the addition of a number.

How To Multiply Without Using * In Python

Wrap Up

Let me know if you have any better method than the one discussed above. I will be happy to Add it here.

If you liked the above tutorial then please follow us on Facebook and Twitter. Let us know the questions and answer you want to cover in this blog.

Further Read:

  1. How To Add or Append Values To a Set In Python
  2. 4 Ways To List All Subdirectories in a Directory – Python
  3. Dict To list – Convert A Dictionary to a List in Python
  4. Discord.py Bot Add Reaction To a Message Python
  5. Python Get The Minimum Value In Dictionary with Key
  6. How To Append Multiple Values To A List in Python
  7. How To Reboot or Restart Python Script

Leave a Reply

Your email address will not be published. Required fields are marked *