首先,我们为用户输入创建3个列表。在这里,我们使用遍历技术。将积的值初始化为1,遍历所有元素,并将每个数字乘以积乘以1,直到列表末尾。
示例Input: A=[5,6,3]
Output:90
Explanation:5*6*3
算法Step 1: input all numbers in the list (lst).
Step 2: to multiply all values in the list we use traversing technique.
Step 3: variable X=1.
Step 4: for i in LST/*traverse from first to last in the list
X=X*i/* multiply elements one by one
Step 5: display X
范例程式码#To multiply all numbers in a list
def mulallnum(lst):
x=1
for i in lst:
x=x*i
return x
#driver code
A=list()
B=list()
C=list()
n1=int(input("Enter the size of the First List ::"))
n2=int(input("Enter the size of the Second List ::"))
n3=int(input("Enter the size of the Third List ::&