This is a python class question write a function product of() that takes an inte
ID: 673841 • Letter: T
Question
This is a python class question
write a function product of() that takes an integer N as a parameter and enters n non-zero numbers from the user . The function returns the product of the n numbers. Assuming n>0 the function repeatedly prompts the user to enter a number. If the number entered can be evaluated and is non-zero, the number is accumulated into a profuct and counts towards the total of n numbers. If the user enteres a number that cannot be evaluated, teh function displays a message and does not count teh entered value toward the total of n numbers. If the user enteres 0. the function displays a different message but again does not count the entered value toward the n numbers. Once n numbers that can be evaluated and are non-zeroare entered, the product is returned. If n<=0 then the function returns 1. You may assume the parameter n is an interger.
Explanation / Answer
Below are the code- def productof(): n =int( input ('Please enter an integer. ')) N= [input('Enter a value: ') for i in range(n)] if N>0: prod = 0 i = 1 while iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.