Answer to Question #224152 in Python for kaavya

Question #224152

Product of Elements in the List

You are given a space-separated list of integers as input. Write a program to print the product of these numbers.

Input

The first line of input contains space-separated integers.

Explanation

In the example, there are

6 numbers, 1, 2, 3, 4, 5, 6.The product of list elements is

1 x 2 x 3 x 4 x 5 x 6 So, the output should be 720.

Sample Input :

1 11 13 21 19

Sample Output:

57057


1
Expert's answer
2021-08-07T03:28:31-0400
Nums = str(input("Enter Numbers separated by SPACE: ")).split(" ")
print(Nums)
Prod = 1
s = ""
for r in range(0,len(Nums)):
    Prod = Prod * int(Nums[r])
    s = s + Nums[r] + " x "
print("Product of list (",s,") = ",Prod)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS