Find the best solutions to your questions at Westonci.ca, the premier Q&A platform with a community of knowledgeable experts. Experience the ease of finding reliable answers to your questions from a vast community of knowledgeable experts. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.
Sagot :
Answer:
The program in Python is as follows:
n = int(input("Number of inputs: "))
total = 0; product = 1
for i in range(n):
num = int(input(": "))
if num%2 == 0:
total+=num
else:
product*=num
print("Sum of even: ",total)
print("Product of odd: ",product)
Explanation:
This prompts the user for the number of inputs, n
n = int(input("Number of inputs: "))
This initializes sum (total) to 0 and products to 1
total = 0; product = 1
This iterates through n
for i in range(n):
This gets the inputs
num = int(input(": "))
If input is even, calculate the sum
if num%2 == 0:
total+=num
If otherwise, calculate the product
else:
product*=num
Print the required outputs
print("Sum of even: ",total)
print("Product of odd: ",product)
Thanks for using our service. We aim to provide the most accurate answers for all your queries. Visit us again for more insights. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. We're dedicated to helping you find the answers you need at Westonci.ca. Don't hesitate to return for more.