generate functionWed, 01 Mar 2023

At each iteration of the loop, an integer is entered. It is necessary to calculate the product of only positive numbers, until the value 0 is entered. Implement skipping calculations using the continue statement, and also use a while loop. Display the result of the work.

def multiply(): res = 1 while True: num = int(input("Enter number: ")) if num == 0: break elif num < 0: continue res = res * num return res multiply()

Questions about programming?Chat with your personal AI assistant