Answer to Question #219372 in Python for chandu

Question #219372

Product of the Given Numbers

Given an integer

N, write a program which reads N inputs and prints the product of the given input integers.Input

The first line of input is a positive integer,

N. The next N lines each contain an integer.Output

The output should be the product of the given input integers.

Explanation

In the given example,

N = 3 and the input integers are 2, 3, and 7.So, the output should be 2 x 3 x 7 = 42


1
Expert's answer
2021-07-22T18:48:06-0400
N = int(input("Please enter positive integer: "))
ints = []
for i in range (N):
    n = int(input("Enter integer {}: ".format(i+1)))
    ints.append(n)
#products
product = 1
for item in ints:
    product = product*item


print("Output is ", product)

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