Answers for "multiplication python"

4

how to multiply in python

Multiply two integer numbers

num1=int(input("Enter the first number: "))
#input value for variable num1
num2=int(input("Enter the second number: "))
#input value for variable num2
mul=num1*num2;
#perform multiplication operation
print("the product of given numbers is: ",mul)
#display the product
  
When the above code is compiled and executed, it produces the following results
Enter the first number: 23
Enter the second number is: 32
the product of the given numbers is 736
Posted by: Guest on April-01-2020
0

matrix multiplication in python

# input two matrices of size n x m 
matrix1 = [[12,7,3], 
        [4 ,5,6], 
        [7 ,8,9]] 
matrix2 = [[5,8,1], 
        [6,7,3], 
        [4,5,9]] 
  
res = [[0 for x in range(3)] for y in range(3)]  
  
# explicit for loops 
for i in range(len(matrix1)): 
    for j in range(len(matrix2[0])): 
        for k in range(len(matrix2)): 
  
            # resulted matrix 
            res[i][j] += matrix1[i][k] * matrix2[k][j] 
  
print (res)
Posted by: Guest on January-05-2021
0

multiplication in python

#* is the multiplication symbol in Python, so:
print(2 * 3)
#output: 6
Posted by: Guest on May-02-2021

Code answers related to "multiplication python"

Python Answers by Framework

Browse Popular Code Answers by Language