Sunday, March 3, 2019

Multiply Function using user define function - Python3

multiply_fun.py
def multiply(number):
    mul = 1
    for numbers in number:
        mul = mul * numbers
    return mul

multiply.py
import multiply_fun

n = int(input("Enter the value of n: "))
L=[]
for i in range(n):
    L.append(int(input("Enter element {}: ".format(i+1))))
    
print ("\nMultiplication of elements of list is: ",multiply_fun.multiply(L))


ScreenShots:

No comments:

Post a Comment