Series13. A set of nonzero integers is given; The sign of its completion is the number 0. Output the sum of all positive even numbers from the given set. If there are no required numbers in the set, output 0.

Solution in Python 3:

import random

x = random.randrange(1,10)
print(x,end='; ')
k = 0
s = 0
if x > 0 and x % 2 == 0:
s += x
while x != 0:
x = random.randrange(-5,6)
print(x,end='; ')
if x > 0 and x % 2 == 0:
s += x
k += 1

print()
print("Amount:",k)
print("Sum of positive even numbers:",s)